<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <meta name="nodejs.org:node-version" content="v19.8.1">
  <title>Web Crypto API | Node.js v19.8.1 Documentation</title>
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:400,700,400italic&display=fallback">
  <link rel="stylesheet" href="assets/style.css">
  <link rel="stylesheet" href="assets/hljs.css">
  <link rel="canonical" href="webcrypto.html">
  <script async defer src="assets/api.js" type="text/javascript"></script>
  
</head>
<body class="alt apidoc" id="api-section-webcrypto">
  <div id="content" class="clearfix">
    <div id="column2" class="interior">
      <div id="intro" class="interior">
        <a href="../index.html" title="Go back to the home page">
          Node.js
        </a>
      </div>
      <ul>
<li><a href="documentation.html" class="nav-documentation">About this documentation</a></li>
<li><a href="synopsis.html" class="nav-synopsis">Usage and example</a></li>
</ul>
<hr class="line">
<ul>
<li><a href="assert.html" class="nav-assert">Assertion testing</a></li>
<li><a href="async_context.html" class="nav-async_context">Asynchronous context tracking</a></li>
<li><a href="async_hooks.html" class="nav-async_hooks">Async hooks</a></li>
<li><a href="buffer.html" class="nav-buffer">Buffer</a></li>
<li><a href="addons.html" class="nav-addons">C++ addons</a></li>
<li><a href="n-api.html" class="nav-n-api">C/C++ addons with Node-API</a></li>
<li><a href="embedding.html" class="nav-embedding">C++ embedder API</a></li>
<li><a href="child_process.html" class="nav-child_process">Child processes</a></li>
<li><a href="cluster.html" class="nav-cluster">Cluster</a></li>
<li><a href="cli.html" class="nav-cli">Command-line options</a></li>
<li><a href="console.html" class="nav-console">Console</a></li>
<li><a href="corepack.html" class="nav-corepack">Corepack</a></li>
<li><a href="crypto.html" class="nav-crypto">Crypto</a></li>
<li><a href="debugger.html" class="nav-debugger">Debugger</a></li>
<li><a href="deprecations.html" class="nav-deprecations">Deprecated APIs</a></li>
<li><a href="diagnostics_channel.html" class="nav-diagnostics_channel">Diagnostics Channel</a></li>
<li><a href="dns.html" class="nav-dns">DNS</a></li>
<li><a href="domain.html" class="nav-domain">Domain</a></li>
<li><a href="errors.html" class="nav-errors">Errors</a></li>
<li><a href="events.html" class="nav-events">Events</a></li>
<li><a href="fs.html" class="nav-fs">File system</a></li>
<li><a href="globals.html" class="nav-globals">Globals</a></li>
<li><a href="http.html" class="nav-http">HTTP</a></li>
<li><a href="http2.html" class="nav-http2">HTTP/2</a></li>
<li><a href="https.html" class="nav-https">HTTPS</a></li>
<li><a href="inspector.html" class="nav-inspector">Inspector</a></li>
<li><a href="intl.html" class="nav-intl">Internationalization</a></li>
<li><a href="modules.html" class="nav-modules">Modules: CommonJS modules</a></li>
<li><a href="esm.html" class="nav-esm">Modules: ECMAScript modules</a></li>
<li><a href="module.html" class="nav-module">Modules: <code>node:module</code> API</a></li>
<li><a href="packages.html" class="nav-packages">Modules: Packages</a></li>
<li><a href="net.html" class="nav-net">Net</a></li>
<li><a href="os.html" class="nav-os">OS</a></li>
<li><a href="path.html" class="nav-path">Path</a></li>
<li><a href="perf_hooks.html" class="nav-perf_hooks">Performance hooks</a></li>
<li><a href="permissions.html" class="nav-permissions">Permissions</a></li>
<li><a href="process.html" class="nav-process">Process</a></li>
<li><a href="punycode.html" class="nav-punycode">Punycode</a></li>
<li><a href="querystring.html" class="nav-querystring">Query strings</a></li>
<li><a href="readline.html" class="nav-readline">Readline</a></li>
<li><a href="repl.html" class="nav-repl">REPL</a></li>
<li><a href="report.html" class="nav-report">Report</a></li>
<li><a href="single-executable-applications.html" class="nav-single-executable-applications">Single executable applications</a></li>
<li><a href="stream.html" class="nav-stream">Stream</a></li>
<li><a href="string_decoder.html" class="nav-string_decoder">String decoder</a></li>
<li><a href="test.html" class="nav-test">Test runner</a></li>
<li><a href="timers.html" class="nav-timers">Timers</a></li>
<li><a href="tls.html" class="nav-tls">TLS/SSL</a></li>
<li><a href="tracing.html" class="nav-tracing">Trace events</a></li>
<li><a href="tty.html" class="nav-tty">TTY</a></li>
<li><a href="dgram.html" class="nav-dgram">UDP/datagram</a></li>
<li><a href="url.html" class="nav-url">URL</a></li>
<li><a href="util.html" class="nav-util">Utilities</a></li>
<li><a href="v8.html" class="nav-v8">V8</a></li>
<li><a href="vm.html" class="nav-vm">VM</a></li>
<li><a href="wasi.html" class="nav-wasi">WASI</a></li>
<li><a href="webcrypto.html" class="nav-webcrypto active">Web Crypto API</a></li>
<li><a href="webstreams.html" class="nav-webstreams">Web Streams API</a></li>
<li><a href="worker_threads.html" class="nav-worker_threads">Worker threads</a></li>
<li><a href="zlib.html" class="nav-zlib">Zlib</a></li>
</ul>
<hr class="line">
<ul>
<li><a href="https://github.com/nodejs/node" class="nav-https-github-com-nodejs-node">Code repository and issue tracker</a></li>
</ul>
    </div>

    <div id="column1" data-id="webcrypto" class="interior">
      <header class="header">
        <div class="header-container">
          <h1>Node.js v19.8.1 documentation</h1>
          <button class="theme-toggle-btn" id="theme-toggle-btn" title="Toggle dark mode/light mode" aria-label="Toggle dark mode/light mode" hidden>
            <svg xmlns="http://www.w3.org/2000/svg" class="icon dark-icon" height="24" width="24">
              <path fill="none" d="M0 0h24v24H0z" />
              <path d="M11.1 12.08c-2.33-4.51-.5-8.48.53-10.07C6.27 2.2 1.98 6.59 1.98 12c0 .14.02.28.02.42.62-.27 1.29-.42 2-.42 1.66 0 3.18.83 4.1 2.15A4.01 4.01 0 0111 18c0 1.52-.87 2.83-2.12 3.51.98.32 2.03.5 3.11.5 3.5 0 6.58-1.8 8.37-4.52-2.36.23-6.98-.97-9.26-5.41z"/>
              <path d="M7 16h-.18C6.4 14.84 5.3 14 4 14c-1.66 0-3 1.34-3 3s1.34 3 3 3h3c1.1 0 2-.9 2-2s-.9-2-2-2z"/>
            </svg>
            <svg xmlns="http://www.w3.org/2000/svg" class="icon light-icon" height="24" width="24">
              <path d="M0 0h24v24H0z" fill="none" />
              <path d="M6.76 4.84l-1.8-1.79-1.41 1.41 1.79 1.79 1.42-1.41zM4 10.5H1v2h3v-2zm9-9.95h-2V3.5h2V.55zm7.45 3.91l-1.41-1.41-1.79 1.79 1.41 1.41 1.79-1.79zm-3.21 13.7l1.79 1.8 1.41-1.41-1.8-1.79-1.4 1.4zM20 10.5v2h3v-2h-3zm-8-5c-3.31 0-6 2.69-6 6s2.69 6 6 6 6-2.69 6-6-2.69-6-6-6zm-1 16.95h2V19.5h-2v2.95zm-7.45-3.91l1.41 1.41 1.79-1.8-1.41-1.41-1.79 1.8z"/>
            </svg>
          </button>
        </div>
        <div id="gtoc">
          <ul>
            <li class="pinned-header">Node.js v19.8.1</li>
            
    <li class="picker-header">
      <a href="webcrypto.html#">
        <span class="collapsed-arrow">&#x25ba;</span><span class="expanded-arrow">&#x25bc;</span>
        Table of contents
      </a>

      <div class="picker"><div class="toc"><ul>
<li><span class="stability_2"><a href="webcrypto.html#web-crypto-api">Web Crypto API</a></span>
<ul>
<li><a href="webcrypto.html#examples">Examples</a>
<ul>
<li><a href="webcrypto.html#generating-keys">Generating keys</a>
<ul>
<li><a href="webcrypto.html#aes-keys">AES keys</a></li>
<li><a href="webcrypto.html#ecdsa-key-pairs">ECDSA key pairs</a></li>
<li><span class="stability_1"><a href="webcrypto.html#ed25519ed448x25519x448-key-pairs">Ed25519/Ed448/X25519/X448 key pairs</a></span></li>
<li><a href="webcrypto.html#hmac-keys">HMAC keys</a></li>
<li><a href="webcrypto.html#rsa-key-pairs">RSA key pairs</a></li>
</ul>
</li>
<li><a href="webcrypto.html#encryption-and-decryption">Encryption and decryption</a></li>
<li><a href="webcrypto.html#exporting-and-importing-keys">Exporting and importing keys</a></li>
<li><a href="webcrypto.html#wrapping-and-unwrapping-keys">Wrapping and unwrapping keys</a></li>
<li><a href="webcrypto.html#sign-and-verify">Sign and verify</a></li>
<li><a href="webcrypto.html#deriving-bits-and-keys">Deriving bits and keys</a></li>
<li><a href="webcrypto.html#digest">Digest</a></li>
</ul>
</li>
<li><a href="webcrypto.html#algorithm-matrix">Algorithm matrix</a></li>
<li><a href="webcrypto.html#class-crypto">Class: <code>Crypto</code></a>
<ul>
<li><a href="webcrypto.html#cryptosubtle"><code>crypto.subtle</code></a></li>
<li><a href="webcrypto.html#cryptogetrandomvaluestypedarray"><code>crypto.getRandomValues(typedArray)</code></a></li>
<li><a href="webcrypto.html#cryptorandomuuid"><code>crypto.randomUUID()</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-cryptokey">Class: <code>CryptoKey</code></a>
<ul>
<li><a href="webcrypto.html#cryptokeyalgorithm"><code>cryptoKey.algorithm</code></a></li>
<li><a href="webcrypto.html#cryptokeyextractable"><code>cryptoKey.extractable</code></a></li>
<li><a href="webcrypto.html#cryptokeytype"><code>cryptoKey.type</code></a></li>
<li><a href="webcrypto.html#cryptokeyusages"><code>cryptoKey.usages</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-cryptokeypair">Class: <code>CryptoKeyPair</code></a>
<ul>
<li><a href="webcrypto.html#cryptokeypairprivatekey"><code>cryptoKeyPair.privateKey</code></a></li>
<li><a href="webcrypto.html#cryptokeypairpublickey"><code>cryptoKeyPair.publicKey</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-subtlecrypto">Class: <code>SubtleCrypto</code></a>
<ul>
<li><a href="webcrypto.html#subtledecryptalgorithm-key-data"><code>subtle.decrypt(algorithm, key, data)</code></a></li>
<li><a href="webcrypto.html#subtlederivebitsalgorithm-basekey-length"><code>subtle.deriveBits(algorithm, baseKey, length)</code></a></li>
<li><a href="webcrypto.html#subtlederivekeyalgorithm-basekey-derivedkeyalgorithm-extractable-keyusages"><code>subtle.deriveKey(algorithm, baseKey, derivedKeyAlgorithm, extractable, keyUsages)</code></a></li>
<li><a href="webcrypto.html#subtledigestalgorithm-data"><code>subtle.digest(algorithm, data)</code></a></li>
<li><a href="webcrypto.html#subtleencryptalgorithm-key-data"><code>subtle.encrypt(algorithm, key, data)</code></a></li>
<li><a href="webcrypto.html#subtleexportkeyformat-key"><code>subtle.exportKey(format, key)</code></a></li>
<li><a href="webcrypto.html#subtlegeneratekeyalgorithm-extractable-keyusages"><code>subtle.generateKey(algorithm, extractable, keyUsages)</code></a></li>
<li><a href="webcrypto.html#subtleimportkeyformat-keydata-algorithm-extractable-keyusages"><code>subtle.importKey(format, keyData, algorithm, extractable, keyUsages)</code></a></li>
<li><a href="webcrypto.html#subtlesignalgorithm-key-data"><code>subtle.sign(algorithm, key, data)</code></a></li>
<li><a href="webcrypto.html#subtleunwrapkeyformat-wrappedkey-unwrappingkey-unwrapalgo-unwrappedkeyalgo-extractable-keyusages"><code>subtle.unwrapKey(format, wrappedKey, unwrappingKey, unwrapAlgo, unwrappedKeyAlgo, extractable, keyUsages)</code></a></li>
<li><a href="webcrypto.html#subtleverifyalgorithm-key-signature-data"><code>subtle.verify(algorithm, key, signature, data)</code></a></li>
<li><a href="webcrypto.html#subtlewrapkeyformat-key-wrappingkey-wrapalgo"><code>subtle.wrapKey(format, key, wrappingKey, wrapAlgo)</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#algorithm-parameters">Algorithm parameters</a>
<ul>
<li><a href="webcrypto.html#class-algorithmidentifier">Class: <code>AlgorithmIdentifier</code></a>
<ul>
<li><a href="webcrypto.html#algorithmidentifiername"><code>algorithmIdentifier.name</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-aescbcparams">Class: <code>AesCbcParams</code></a>
<ul>
<li><a href="webcrypto.html#aescbcparamsiv"><code>aesCbcParams.iv</code></a></li>
<li><a href="webcrypto.html#aescbcparamsname"><code>aesCbcParams.name</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-aesctrparams">Class: <code>AesCtrParams</code></a>
<ul>
<li><a href="webcrypto.html#aesctrparamscounter"><code>aesCtrParams.counter</code></a></li>
<li><a href="webcrypto.html#aesctrparamslength"><code>aesCtrParams.length</code></a></li>
<li><a href="webcrypto.html#aesctrparamsname"><code>aesCtrParams.name</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-aesgcmparams">Class: <code>AesGcmParams</code></a>
<ul>
<li><a href="webcrypto.html#aesgcmparamsadditionaldata"><code>aesGcmParams.additionalData</code></a></li>
<li><a href="webcrypto.html#aesgcmparamsiv"><code>aesGcmParams.iv</code></a></li>
<li><a href="webcrypto.html#aesgcmparamsname"><code>aesGcmParams.name</code></a></li>
<li><a href="webcrypto.html#aesgcmparamstaglength"><code>aesGcmParams.tagLength</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-aeskeygenparams">Class: <code>AesKeyGenParams</code></a>
<ul>
<li><a href="webcrypto.html#aeskeygenparamslength"><code>aesKeyGenParams.length</code></a></li>
<li><a href="webcrypto.html#aeskeygenparamsname"><code>aesKeyGenParams.name</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-ecdhkeyderiveparams">Class: <code>EcdhKeyDeriveParams</code></a>
<ul>
<li><a href="webcrypto.html#ecdhkeyderiveparamsname"><code>ecdhKeyDeriveParams.name</code></a></li>
<li><a href="webcrypto.html#ecdhkeyderiveparamspublic"><code>ecdhKeyDeriveParams.public</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-ecdsaparams">Class: <code>EcdsaParams</code></a>
<ul>
<li><a href="webcrypto.html#ecdsaparamshash"><code>ecdsaParams.hash</code></a></li>
<li><a href="webcrypto.html#ecdsaparamsname"><code>ecdsaParams.name</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-eckeygenparams">Class: <code>EcKeyGenParams</code></a>
<ul>
<li><a href="webcrypto.html#eckeygenparamsname"><code>ecKeyGenParams.name</code></a></li>
<li><a href="webcrypto.html#eckeygenparamsnamedcurve"><code>ecKeyGenParams.namedCurve</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-eckeyimportparams">Class: <code>EcKeyImportParams</code></a>
<ul>
<li><a href="webcrypto.html#eckeyimportparamsname"><code>ecKeyImportParams.name</code></a></li>
<li><a href="webcrypto.html#eckeyimportparamsnamedcurve"><code>ecKeyImportParams.namedCurve</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-ed448params">Class: <code>Ed448Params</code></a>
<ul>
<li><a href="webcrypto.html#ed448paramsname"><code>ed448Params.name</code></a></li>
<li><a href="webcrypto.html#ed448paramscontext"><code>ed448Params.context</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-hkdfparams">Class: <code>HkdfParams</code></a>
<ul>
<li><a href="webcrypto.html#hkdfparamshash"><code>hkdfParams.hash</code></a></li>
<li><a href="webcrypto.html#hkdfparamsinfo"><code>hkdfParams.info</code></a></li>
<li><a href="webcrypto.html#hkdfparamsname"><code>hkdfParams.name</code></a></li>
<li><a href="webcrypto.html#hkdfparamssalt"><code>hkdfParams.salt</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-hmacimportparams">Class: <code>HmacImportParams</code></a>
<ul>
<li><a href="webcrypto.html#hmacimportparamshash"><code>hmacImportParams.hash</code></a></li>
<li><a href="webcrypto.html#hmacimportparamslength"><code>hmacImportParams.length</code></a></li>
<li><a href="webcrypto.html#hmacimportparamsname"><code>hmacImportParams.name</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-hmackeygenparams">Class: <code>HmacKeyGenParams</code></a>
<ul>
<li><a href="webcrypto.html#hmackeygenparamshash"><code>hmacKeyGenParams.hash</code></a></li>
<li><a href="webcrypto.html#hmackeygenparamslength"><code>hmacKeyGenParams.length</code></a></li>
<li><a href="webcrypto.html#hmackeygenparamsname"><code>hmacKeyGenParams.name</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-pbkdf2params">Class: <code>Pbkdf2Params</code></a>
<ul>
<li><a href="webcrypto.html#pbkdb2paramshash"><code>pbkdb2Params.hash</code></a></li>
<li><a href="webcrypto.html#pbkdf2paramsiterations"><code>pbkdf2Params.iterations</code></a></li>
<li><a href="webcrypto.html#pbkdf2paramsname"><code>pbkdf2Params.name</code></a></li>
<li><a href="webcrypto.html#pbkdf2paramssalt"><code>pbkdf2Params.salt</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-rsahashedimportparams">Class: <code>RsaHashedImportParams</code></a>
<ul>
<li><a href="webcrypto.html#rsahashedimportparamshash"><code>rsaHashedImportParams.hash</code></a></li>
<li><a href="webcrypto.html#rsahashedimportparamsname"><code>rsaHashedImportParams.name</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-rsahashedkeygenparams">Class: <code>RsaHashedKeyGenParams</code></a>
<ul>
<li><a href="webcrypto.html#rsahashedkeygenparamshash"><code>rsaHashedKeyGenParams.hash</code></a></li>
<li><a href="webcrypto.html#rsahashedkeygenparamsmoduluslength"><code>rsaHashedKeyGenParams.modulusLength</code></a></li>
<li><a href="webcrypto.html#rsahashedkeygenparamsname"><code>rsaHashedKeyGenParams.name</code></a></li>
<li><a href="webcrypto.html#rsahashedkeygenparamspublicexponent"><code>rsaHashedKeyGenParams.publicExponent</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-rsaoaepparams">Class: <code>RsaOaepParams</code></a>
<ul>
<li><a href="webcrypto.html#rsaoaepparamslabel"><code>rsaOaepParams.label</code></a></li>
<li><a href="webcrypto.html#rsaoaepparamsname"><code>rsaOaepParams.name</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-rsapssparams">Class: <code>RsaPssParams</code></a>
<ul>
<li><a href="webcrypto.html#rsapssparamsname"><code>rsaPssParams.name</code></a></li>
<li><a href="webcrypto.html#rsapssparamssaltlength"><code>rsaPssParams.saltLength</code></a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul></div></div>
    </li>
  
            
    <li class="picker-header">
      <a href="webcrypto.html#">
        <span class="collapsed-arrow">&#x25ba;</span><span class="expanded-arrow">&#x25bc;</span>
        Index
      </a>

      <div class="picker"><ul>
<li><a href="documentation.html" class="nav-documentation">About this documentation</a></li>
<li><a href="synopsis.html" class="nav-synopsis">Usage and example</a></li>

      <li>
        <a href="index.html">Index</a>
      </li>
    </ul>
  
<hr class="line">
<ul>
<li><a href="assert.html" class="nav-assert">Assertion testing</a></li>
<li><a href="async_context.html" class="nav-async_context">Asynchronous context tracking</a></li>
<li><a href="async_hooks.html" class="nav-async_hooks">Async hooks</a></li>
<li><a href="buffer.html" class="nav-buffer">Buffer</a></li>
<li><a href="addons.html" class="nav-addons">C++ addons</a></li>
<li><a href="n-api.html" class="nav-n-api">C/C++ addons with Node-API</a></li>
<li><a href="embedding.html" class="nav-embedding">C++ embedder API</a></li>
<li><a href="child_process.html" class="nav-child_process">Child processes</a></li>
<li><a href="cluster.html" class="nav-cluster">Cluster</a></li>
<li><a href="cli.html" class="nav-cli">Command-line options</a></li>
<li><a href="console.html" class="nav-console">Console</a></li>
<li><a href="corepack.html" class="nav-corepack">Corepack</a></li>
<li><a href="crypto.html" class="nav-crypto">Crypto</a></li>
<li><a href="debugger.html" class="nav-debugger">Debugger</a></li>
<li><a href="deprecations.html" class="nav-deprecations">Deprecated APIs</a></li>
<li><a href="diagnostics_channel.html" class="nav-diagnostics_channel">Diagnostics Channel</a></li>
<li><a href="dns.html" class="nav-dns">DNS</a></li>
<li><a href="domain.html" class="nav-domain">Domain</a></li>
<li><a href="errors.html" class="nav-errors">Errors</a></li>
<li><a href="events.html" class="nav-events">Events</a></li>
<li><a href="fs.html" class="nav-fs">File system</a></li>
<li><a href="globals.html" class="nav-globals">Globals</a></li>
<li><a href="http.html" class="nav-http">HTTP</a></li>
<li><a href="http2.html" class="nav-http2">HTTP/2</a></li>
<li><a href="https.html" class="nav-https">HTTPS</a></li>
<li><a href="inspector.html" class="nav-inspector">Inspector</a></li>
<li><a href="intl.html" class="nav-intl">Internationalization</a></li>
<li><a href="modules.html" class="nav-modules">Modules: CommonJS modules</a></li>
<li><a href="esm.html" class="nav-esm">Modules: ECMAScript modules</a></li>
<li><a href="module.html" class="nav-module">Modules: <code>node:module</code> API</a></li>
<li><a href="packages.html" class="nav-packages">Modules: Packages</a></li>
<li><a href="net.html" class="nav-net">Net</a></li>
<li><a href="os.html" class="nav-os">OS</a></li>
<li><a href="path.html" class="nav-path">Path</a></li>
<li><a href="perf_hooks.html" class="nav-perf_hooks">Performance hooks</a></li>
<li><a href="permissions.html" class="nav-permissions">Permissions</a></li>
<li><a href="process.html" class="nav-process">Process</a></li>
<li><a href="punycode.html" class="nav-punycode">Punycode</a></li>
<li><a href="querystring.html" class="nav-querystring">Query strings</a></li>
<li><a href="readline.html" class="nav-readline">Readline</a></li>
<li><a href="repl.html" class="nav-repl">REPL</a></li>
<li><a href="report.html" class="nav-report">Report</a></li>
<li><a href="single-executable-applications.html" class="nav-single-executable-applications">Single executable applications</a></li>
<li><a href="stream.html" class="nav-stream">Stream</a></li>
<li><a href="string_decoder.html" class="nav-string_decoder">String decoder</a></li>
<li><a href="test.html" class="nav-test">Test runner</a></li>
<li><a href="timers.html" class="nav-timers">Timers</a></li>
<li><a href="tls.html" class="nav-tls">TLS/SSL</a></li>
<li><a href="tracing.html" class="nav-tracing">Trace events</a></li>
<li><a href="tty.html" class="nav-tty">TTY</a></li>
<li><a href="dgram.html" class="nav-dgram">UDP/datagram</a></li>
<li><a href="url.html" class="nav-url">URL</a></li>
<li><a href="util.html" class="nav-util">Utilities</a></li>
<li><a href="v8.html" class="nav-v8">V8</a></li>
<li><a href="vm.html" class="nav-vm">VM</a></li>
<li><a href="wasi.html" class="nav-wasi">WASI</a></li>
<li><a href="webcrypto.html" class="nav-webcrypto active">Web Crypto API</a></li>
<li><a href="webstreams.html" class="nav-webstreams">Web Streams API</a></li>
<li><a href="worker_threads.html" class="nav-worker_threads">Worker threads</a></li>
<li><a href="zlib.html" class="nav-zlib">Zlib</a></li>
</ul>
<hr class="line">
<ul>
<li><a href="https://github.com/nodejs/node" class="nav-https-github-com-nodejs-node">Code repository and issue tracker</a></li>
</ul></div>
    </li>
  
            
    <li class="picker-header">
      <a href="webcrypto.html#">
        <span class="collapsed-arrow">&#x25ba;</span><span class="expanded-arrow">&#x25bc;</span>
        Other versions
      </a>
      <div class="picker"><ol id="alt-docs"><li><a href="https://nodejs.org/docs/latest-v19.x/api/webcrypto.html">19.x</a></li>
<li><a href="https://nodejs.org/docs/latest-v18.x/api/webcrypto.html">18.x <b>LTS</b></a></li>
<li><a href="https://nodejs.org/docs/latest-v17.x/api/webcrypto.html">17.x</a></li>
<li><a href="https://nodejs.org/docs/latest-v16.x/api/webcrypto.html">16.x <b>LTS</b></a></li>
<li><a href="https://nodejs.org/docs/latest-v15.x/api/webcrypto.html">15.x</a></li></ol></div>
    </li>
  
            <li class="picker-header">
              <a href="webcrypto.html#">
                <span class="collapsed-arrow">&#x25ba;</span><span class="expanded-arrow">&#x25bc;</span>
                Options
              </a>
        
              <div class="picker">
                <ul>
                  <li>
                    <a href="all.html">View on single page</a>
                  </li>
                  <li>
                    <a href="webcrypto.json">View as JSON</a>
                  </li>
                  <li class="edit_on_github"><a href="https://github.com/nodejs/node/edit/main/doc/api/webcrypto.md">Edit on GitHub</a></li>    
                </ul>
              </div>
            </li>
          </ul>
        </div>
        <hr>
      </header>

      <details id="toc" open><summary>Table of contents</summary><ul>
<li><span class="stability_2"><a href="webcrypto.html#web-crypto-api">Web Crypto API</a></span>
<ul>
<li><a href="webcrypto.html#examples">Examples</a>
<ul>
<li><a href="webcrypto.html#generating-keys">Generating keys</a>
<ul>
<li><a href="webcrypto.html#aes-keys">AES keys</a></li>
<li><a href="webcrypto.html#ecdsa-key-pairs">ECDSA key pairs</a></li>
<li><span class="stability_1"><a href="webcrypto.html#ed25519ed448x25519x448-key-pairs">Ed25519/Ed448/X25519/X448 key pairs</a></span></li>
<li><a href="webcrypto.html#hmac-keys">HMAC keys</a></li>
<li><a href="webcrypto.html#rsa-key-pairs">RSA key pairs</a></li>
</ul>
</li>
<li><a href="webcrypto.html#encryption-and-decryption">Encryption and decryption</a></li>
<li><a href="webcrypto.html#exporting-and-importing-keys">Exporting and importing keys</a></li>
<li><a href="webcrypto.html#wrapping-and-unwrapping-keys">Wrapping and unwrapping keys</a></li>
<li><a href="webcrypto.html#sign-and-verify">Sign and verify</a></li>
<li><a href="webcrypto.html#deriving-bits-and-keys">Deriving bits and keys</a></li>
<li><a href="webcrypto.html#digest">Digest</a></li>
</ul>
</li>
<li><a href="webcrypto.html#algorithm-matrix">Algorithm matrix</a></li>
<li><a href="webcrypto.html#class-crypto">Class: <code>Crypto</code></a>
<ul>
<li><a href="webcrypto.html#cryptosubtle"><code>crypto.subtle</code></a></li>
<li><a href="webcrypto.html#cryptogetrandomvaluestypedarray"><code>crypto.getRandomValues(typedArray)</code></a></li>
<li><a href="webcrypto.html#cryptorandomuuid"><code>crypto.randomUUID()</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-cryptokey">Class: <code>CryptoKey</code></a>
<ul>
<li><a href="webcrypto.html#cryptokeyalgorithm"><code>cryptoKey.algorithm</code></a></li>
<li><a href="webcrypto.html#cryptokeyextractable"><code>cryptoKey.extractable</code></a></li>
<li><a href="webcrypto.html#cryptokeytype"><code>cryptoKey.type</code></a></li>
<li><a href="webcrypto.html#cryptokeyusages"><code>cryptoKey.usages</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-cryptokeypair">Class: <code>CryptoKeyPair</code></a>
<ul>
<li><a href="webcrypto.html#cryptokeypairprivatekey"><code>cryptoKeyPair.privateKey</code></a></li>
<li><a href="webcrypto.html#cryptokeypairpublickey"><code>cryptoKeyPair.publicKey</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-subtlecrypto">Class: <code>SubtleCrypto</code></a>
<ul>
<li><a href="webcrypto.html#subtledecryptalgorithm-key-data"><code>subtle.decrypt(algorithm, key, data)</code></a></li>
<li><a href="webcrypto.html#subtlederivebitsalgorithm-basekey-length"><code>subtle.deriveBits(algorithm, baseKey, length)</code></a></li>
<li><a href="webcrypto.html#subtlederivekeyalgorithm-basekey-derivedkeyalgorithm-extractable-keyusages"><code>subtle.deriveKey(algorithm, baseKey, derivedKeyAlgorithm, extractable, keyUsages)</code></a></li>
<li><a href="webcrypto.html#subtledigestalgorithm-data"><code>subtle.digest(algorithm, data)</code></a></li>
<li><a href="webcrypto.html#subtleencryptalgorithm-key-data"><code>subtle.encrypt(algorithm, key, data)</code></a></li>
<li><a href="webcrypto.html#subtleexportkeyformat-key"><code>subtle.exportKey(format, key)</code></a></li>
<li><a href="webcrypto.html#subtlegeneratekeyalgorithm-extractable-keyusages"><code>subtle.generateKey(algorithm, extractable, keyUsages)</code></a></li>
<li><a href="webcrypto.html#subtleimportkeyformat-keydata-algorithm-extractable-keyusages"><code>subtle.importKey(format, keyData, algorithm, extractable, keyUsages)</code></a></li>
<li><a href="webcrypto.html#subtlesignalgorithm-key-data"><code>subtle.sign(algorithm, key, data)</code></a></li>
<li><a href="webcrypto.html#subtleunwrapkeyformat-wrappedkey-unwrappingkey-unwrapalgo-unwrappedkeyalgo-extractable-keyusages"><code>subtle.unwrapKey(format, wrappedKey, unwrappingKey, unwrapAlgo, unwrappedKeyAlgo, extractable, keyUsages)</code></a></li>
<li><a href="webcrypto.html#subtleverifyalgorithm-key-signature-data"><code>subtle.verify(algorithm, key, signature, data)</code></a></li>
<li><a href="webcrypto.html#subtlewrapkeyformat-key-wrappingkey-wrapalgo"><code>subtle.wrapKey(format, key, wrappingKey, wrapAlgo)</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#algorithm-parameters">Algorithm parameters</a>
<ul>
<li><a href="webcrypto.html#class-algorithmidentifier">Class: <code>AlgorithmIdentifier</code></a>
<ul>
<li><a href="webcrypto.html#algorithmidentifiername"><code>algorithmIdentifier.name</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-aescbcparams">Class: <code>AesCbcParams</code></a>
<ul>
<li><a href="webcrypto.html#aescbcparamsiv"><code>aesCbcParams.iv</code></a></li>
<li><a href="webcrypto.html#aescbcparamsname"><code>aesCbcParams.name</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-aesctrparams">Class: <code>AesCtrParams</code></a>
<ul>
<li><a href="webcrypto.html#aesctrparamscounter"><code>aesCtrParams.counter</code></a></li>
<li><a href="webcrypto.html#aesctrparamslength"><code>aesCtrParams.length</code></a></li>
<li><a href="webcrypto.html#aesctrparamsname"><code>aesCtrParams.name</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-aesgcmparams">Class: <code>AesGcmParams</code></a>
<ul>
<li><a href="webcrypto.html#aesgcmparamsadditionaldata"><code>aesGcmParams.additionalData</code></a></li>
<li><a href="webcrypto.html#aesgcmparamsiv"><code>aesGcmParams.iv</code></a></li>
<li><a href="webcrypto.html#aesgcmparamsname"><code>aesGcmParams.name</code></a></li>
<li><a href="webcrypto.html#aesgcmparamstaglength"><code>aesGcmParams.tagLength</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-aeskeygenparams">Class: <code>AesKeyGenParams</code></a>
<ul>
<li><a href="webcrypto.html#aeskeygenparamslength"><code>aesKeyGenParams.length</code></a></li>
<li><a href="webcrypto.html#aeskeygenparamsname"><code>aesKeyGenParams.name</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-ecdhkeyderiveparams">Class: <code>EcdhKeyDeriveParams</code></a>
<ul>
<li><a href="webcrypto.html#ecdhkeyderiveparamsname"><code>ecdhKeyDeriveParams.name</code></a></li>
<li><a href="webcrypto.html#ecdhkeyderiveparamspublic"><code>ecdhKeyDeriveParams.public</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-ecdsaparams">Class: <code>EcdsaParams</code></a>
<ul>
<li><a href="webcrypto.html#ecdsaparamshash"><code>ecdsaParams.hash</code></a></li>
<li><a href="webcrypto.html#ecdsaparamsname"><code>ecdsaParams.name</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-eckeygenparams">Class: <code>EcKeyGenParams</code></a>
<ul>
<li><a href="webcrypto.html#eckeygenparamsname"><code>ecKeyGenParams.name</code></a></li>
<li><a href="webcrypto.html#eckeygenparamsnamedcurve"><code>ecKeyGenParams.namedCurve</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-eckeyimportparams">Class: <code>EcKeyImportParams</code></a>
<ul>
<li><a href="webcrypto.html#eckeyimportparamsname"><code>ecKeyImportParams.name</code></a></li>
<li><a href="webcrypto.html#eckeyimportparamsnamedcurve"><code>ecKeyImportParams.namedCurve</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-ed448params">Class: <code>Ed448Params</code></a>
<ul>
<li><a href="webcrypto.html#ed448paramsname"><code>ed448Params.name</code></a></li>
<li><a href="webcrypto.html#ed448paramscontext"><code>ed448Params.context</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-hkdfparams">Class: <code>HkdfParams</code></a>
<ul>
<li><a href="webcrypto.html#hkdfparamshash"><code>hkdfParams.hash</code></a></li>
<li><a href="webcrypto.html#hkdfparamsinfo"><code>hkdfParams.info</code></a></li>
<li><a href="webcrypto.html#hkdfparamsname"><code>hkdfParams.name</code></a></li>
<li><a href="webcrypto.html#hkdfparamssalt"><code>hkdfParams.salt</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-hmacimportparams">Class: <code>HmacImportParams</code></a>
<ul>
<li><a href="webcrypto.html#hmacimportparamshash"><code>hmacImportParams.hash</code></a></li>
<li><a href="webcrypto.html#hmacimportparamslength"><code>hmacImportParams.length</code></a></li>
<li><a href="webcrypto.html#hmacimportparamsname"><code>hmacImportParams.name</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-hmackeygenparams">Class: <code>HmacKeyGenParams</code></a>
<ul>
<li><a href="webcrypto.html#hmackeygenparamshash"><code>hmacKeyGenParams.hash</code></a></li>
<li><a href="webcrypto.html#hmackeygenparamslength"><code>hmacKeyGenParams.length</code></a></li>
<li><a href="webcrypto.html#hmackeygenparamsname"><code>hmacKeyGenParams.name</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-pbkdf2params">Class: <code>Pbkdf2Params</code></a>
<ul>
<li><a href="webcrypto.html#pbkdb2paramshash"><code>pbkdb2Params.hash</code></a></li>
<li><a href="webcrypto.html#pbkdf2paramsiterations"><code>pbkdf2Params.iterations</code></a></li>
<li><a href="webcrypto.html#pbkdf2paramsname"><code>pbkdf2Params.name</code></a></li>
<li><a href="webcrypto.html#pbkdf2paramssalt"><code>pbkdf2Params.salt</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-rsahashedimportparams">Class: <code>RsaHashedImportParams</code></a>
<ul>
<li><a href="webcrypto.html#rsahashedimportparamshash"><code>rsaHashedImportParams.hash</code></a></li>
<li><a href="webcrypto.html#rsahashedimportparamsname"><code>rsaHashedImportParams.name</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-rsahashedkeygenparams">Class: <code>RsaHashedKeyGenParams</code></a>
<ul>
<li><a href="webcrypto.html#rsahashedkeygenparamshash"><code>rsaHashedKeyGenParams.hash</code></a></li>
<li><a href="webcrypto.html#rsahashedkeygenparamsmoduluslength"><code>rsaHashedKeyGenParams.modulusLength</code></a></li>
<li><a href="webcrypto.html#rsahashedkeygenparamsname"><code>rsaHashedKeyGenParams.name</code></a></li>
<li><a href="webcrypto.html#rsahashedkeygenparamspublicexponent"><code>rsaHashedKeyGenParams.publicExponent</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-rsaoaepparams">Class: <code>RsaOaepParams</code></a>
<ul>
<li><a href="webcrypto.html#rsaoaepparamslabel"><code>rsaOaepParams.label</code></a></li>
<li><a href="webcrypto.html#rsaoaepparamsname"><code>rsaOaepParams.name</code></a></li>
</ul>
</li>
<li><a href="webcrypto.html#class-rsapssparams">Class: <code>RsaPssParams</code></a>
<ul>
<li><a href="webcrypto.html#rsapssparamsname"><code>rsaPssParams.name</code></a></li>
<li><a href="webcrypto.html#rsapssparamssaltlength"><code>rsaPssParams.saltLength</code></a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul></details>

      <div id="apicontent">
        <h2>Web Crypto API<span><a class="mark" href="webcrypto.html#web-crypto-api" id="web-crypto-api">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_web_crypto_api"></a></h2>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v19.0.0</td>
<td><p>No longer experimental except for the <code>Ed25519</code>, <code>Ed448</code>, <code>X25519</code>, and <code>X448</code> algorithms.</p></td></tr>
<tr><td>v18.4.0, v16.17.0</td>
<td><p>Removed proprietary <code>'node.keyObject'</code> import/export format.</p></td></tr>
<tr><td>v18.4.0, v16.17.0</td>
<td><p>Removed proprietary <code>'NODE-DSA'</code>, <code>'NODE-DH'</code>, and <code>'NODE-SCRYPT'</code> algorithms.</p></td></tr>
<tr><td>v18.4.0, v16.17.0</td>
<td><p>Added <code>'Ed25519'</code>, <code>'Ed448'</code>, <code>'X25519'</code>, and <code>'X448'</code> algorithms.</p></td></tr>
<tr><td>v18.4.0, v16.17.0</td>
<td><p>Removed proprietary <code>'NODE-ED25519'</code> and <code>'NODE-ED448'</code> algorithms.</p></td></tr>
<tr><td>v18.4.0, v16.17.0</td>
<td><p>Removed proprietary <code>'NODE-X25519'</code> and <code>'NODE-X448'</code> named curves from the <code>'ECDH'</code> algorithm.</p></td></tr>
</tbody></table>
</details>
</div>

<p></p><div class="api_stability api_stability_2"><a href="documentation.html#stability-index">Stability: 2</a> - Stable</div><p></p>
<p>Node.js provides an implementation of the standard <a href="https://www.w3.org/TR/WebCryptoAPI/">Web Crypto API</a>.</p>
<p>Use <code>globalThis.crypto</code> or <code>require('node:crypto').webcrypto</code> to access this
module.</p>
<pre><code class="language-js"><span class="hljs-keyword">const</span> { subtle } = globalThis.<span class="hljs-property">crypto</span>;

(<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span>(<span class="hljs-params"></span>) {

  <span class="hljs-keyword">const</span> key = <span class="hljs-keyword">await</span> subtle.<span class="hljs-title function_">generateKey</span>({
    <span class="hljs-attr">name</span>: <span class="hljs-string">'HMAC'</span>,
    <span class="hljs-attr">hash</span>: <span class="hljs-string">'SHA-256'</span>,
    <span class="hljs-attr">length</span>: <span class="hljs-number">256</span>,
  }, <span class="hljs-literal">true</span>, [<span class="hljs-string">'sign'</span>, <span class="hljs-string">'verify'</span>]);

  <span class="hljs-keyword">const</span> enc = <span class="hljs-keyword">new</span> <span class="hljs-title class_">TextEncoder</span>();
  <span class="hljs-keyword">const</span> message = enc.<span class="hljs-title function_">encode</span>(<span class="hljs-string">'I love cupcakes'</span>);

  <span class="hljs-keyword">const</span> digest = <span class="hljs-keyword">await</span> subtle.<span class="hljs-title function_">sign</span>({
    <span class="hljs-attr">name</span>: <span class="hljs-string">'HMAC'</span>,
  }, key, message);

})();</code></pre>
<section><h3>Examples<span><a class="mark" href="webcrypto.html#examples" id="examples">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_examples"></a></h3>
<h4>Generating keys<span><a class="mark" href="webcrypto.html#generating-keys" id="generating-keys">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_generating_keys"></a></h4>
<p>The <a href="webcrypto.html#class-subtlecrypto" class="type">&#x3C;SubtleCrypto></a> class can be used to generate symmetric (secret) keys
or asymmetric key pairs (public key and private key).</p>
<h5>AES keys<span><a class="mark" href="webcrypto.html#aes-keys" id="aes-keys">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_aes_keys"></a></h5>
<pre><code class="language-js"><span class="hljs-keyword">const</span> { subtle } = globalThis.<span class="hljs-property">crypto</span>;

<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">generateAesKey</span>(<span class="hljs-params">length = <span class="hljs-number">256</span></span>) {
  <span class="hljs-keyword">const</span> key = <span class="hljs-keyword">await</span> subtle.<span class="hljs-title function_">generateKey</span>({
    <span class="hljs-attr">name</span>: <span class="hljs-string">'AES-CBC'</span>,
    length,
  }, <span class="hljs-literal">true</span>, [<span class="hljs-string">'encrypt'</span>, <span class="hljs-string">'decrypt'</span>]);

  <span class="hljs-keyword">return</span> key;
}</code></pre>
<h5>ECDSA key pairs<span><a class="mark" href="webcrypto.html#ecdsa-key-pairs" id="ecdsa-key-pairs">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_ecdsa_key_pairs"></a></h5>
<pre><code class="language-js"><span class="hljs-keyword">const</span> { subtle } = globalThis.<span class="hljs-property">crypto</span>;

<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">generateEcKey</span>(<span class="hljs-params">namedCurve = <span class="hljs-string">'P-521'</span></span>) {
  <span class="hljs-keyword">const</span> {
    publicKey,
    privateKey,
  } = <span class="hljs-keyword">await</span> subtle.<span class="hljs-title function_">generateKey</span>({
    <span class="hljs-attr">name</span>: <span class="hljs-string">'ECDSA'</span>,
    namedCurve,
  }, <span class="hljs-literal">true</span>, [<span class="hljs-string">'sign'</span>, <span class="hljs-string">'verify'</span>]);

  <span class="hljs-keyword">return</span> { publicKey, privateKey };
}</code></pre>
<h5>Ed25519/Ed448/X25519/X448 key pairs<span><a class="mark" href="webcrypto.html#ed25519ed448x25519x448-key-pairs" id="ed25519ed448x25519x448-key-pairs">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_ed25519_ed448_x25519_x448_key_pairs"></a></h5>
<p></p><div class="api_stability api_stability_1"><a href="documentation.html#stability-index">Stability: 1</a> - Experimental</div><p></p>
<pre><code class="language-js"><span class="hljs-keyword">const</span> { subtle } = globalThis.<span class="hljs-property">crypto</span>;

<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">generateEd25519Key</span>(<span class="hljs-params"></span>) {
  <span class="hljs-keyword">return</span> subtle.<span class="hljs-title function_">generateKey</span>({
    <span class="hljs-attr">name</span>: <span class="hljs-string">'Ed25519'</span>,
  }, <span class="hljs-literal">true</span>, [<span class="hljs-string">'sign'</span>, <span class="hljs-string">'verify'</span>]);
}

<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">generateX25519Key</span>(<span class="hljs-params"></span>) {
  <span class="hljs-keyword">return</span> subtle.<span class="hljs-title function_">generateKey</span>({
    <span class="hljs-attr">name</span>: <span class="hljs-string">'X25519'</span>,
  }, <span class="hljs-literal">true</span>, [<span class="hljs-string">'deriveKey'</span>]);
}</code></pre>
<h5>HMAC keys<span><a class="mark" href="webcrypto.html#hmac-keys" id="hmac-keys">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_hmac_keys"></a></h5>
<pre><code class="language-js"><span class="hljs-keyword">const</span> { subtle } = globalThis.<span class="hljs-property">crypto</span>;

<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">generateHmacKey</span>(<span class="hljs-params">hash = <span class="hljs-string">'SHA-256'</span></span>) {
  <span class="hljs-keyword">const</span> key = <span class="hljs-keyword">await</span> subtle.<span class="hljs-title function_">generateKey</span>({
    <span class="hljs-attr">name</span>: <span class="hljs-string">'HMAC'</span>,
    hash,
  }, <span class="hljs-literal">true</span>, [<span class="hljs-string">'sign'</span>, <span class="hljs-string">'verify'</span>]);

  <span class="hljs-keyword">return</span> key;
}</code></pre>
<h5>RSA key pairs<span><a class="mark" href="webcrypto.html#rsa-key-pairs" id="rsa-key-pairs">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_rsa_key_pairs"></a></h5>
<pre><code class="language-js"><span class="hljs-keyword">const</span> { subtle } = globalThis.<span class="hljs-property">crypto</span>;
<span class="hljs-keyword">const</span> publicExponent = <span class="hljs-keyword">new</span> <span class="hljs-title class_">Uint8Array</span>([<span class="hljs-number">1</span>, <span class="hljs-number">0</span>, <span class="hljs-number">1</span>]);

<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">generateRsaKey</span>(<span class="hljs-params">modulusLength = <span class="hljs-number">2048</span>, hash = <span class="hljs-string">'SHA-256'</span></span>) {
  <span class="hljs-keyword">const</span> {
    publicKey,
    privateKey,
  } = <span class="hljs-keyword">await</span> subtle.<span class="hljs-title function_">generateKey</span>({
    <span class="hljs-attr">name</span>: <span class="hljs-string">'RSASSA-PKCS1-v1_5'</span>,
    modulusLength,
    publicExponent,
    hash,
  }, <span class="hljs-literal">true</span>, [<span class="hljs-string">'sign'</span>, <span class="hljs-string">'verify'</span>]);

  <span class="hljs-keyword">return</span> { publicKey, privateKey };
}</code></pre>
<h4>Encryption and decryption<span><a class="mark" href="webcrypto.html#encryption-and-decryption" id="encryption-and-decryption">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_encryption_and_decryption"></a></h4>
<pre><code class="language-js"><span class="hljs-keyword">const</span> crypto = globalThis.<span class="hljs-property">crypto</span>;

<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">aesEncrypt</span>(<span class="hljs-params">plaintext</span>) {
  <span class="hljs-keyword">const</span> ec = <span class="hljs-keyword">new</span> <span class="hljs-title class_">TextEncoder</span>();
  <span class="hljs-keyword">const</span> key = <span class="hljs-keyword">await</span> <span class="hljs-title function_">generateAesKey</span>();
  <span class="hljs-keyword">const</span> iv = crypto.<span class="hljs-title function_">getRandomValues</span>(<span class="hljs-keyword">new</span> <span class="hljs-title class_">Uint8Array</span>(<span class="hljs-number">16</span>));

  <span class="hljs-keyword">const</span> ciphertext = <span class="hljs-keyword">await</span> crypto.<span class="hljs-property">subtle</span>.<span class="hljs-title function_">encrypt</span>({
    <span class="hljs-attr">name</span>: <span class="hljs-string">'AES-CBC'</span>,
    iv,
  }, key, ec.<span class="hljs-title function_">encode</span>(plaintext));

  <span class="hljs-keyword">return</span> {
    key,
    iv,
    ciphertext,
  };
}

<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">aesDecrypt</span>(<span class="hljs-params">ciphertext, key, iv</span>) {
  <span class="hljs-keyword">const</span> dec = <span class="hljs-keyword">new</span> <span class="hljs-title class_">TextDecoder</span>();
  <span class="hljs-keyword">const</span> plaintext = <span class="hljs-keyword">await</span> crypto.<span class="hljs-property">subtle</span>.<span class="hljs-title function_">decrypt</span>({
    <span class="hljs-attr">name</span>: <span class="hljs-string">'AES-CBC'</span>,
    iv,
  }, key, ciphertext);

  <span class="hljs-keyword">return</span> dec.<span class="hljs-title function_">decode</span>(plaintext);
}</code></pre>
<h4>Exporting and importing keys<span><a class="mark" href="webcrypto.html#exporting-and-importing-keys" id="exporting-and-importing-keys">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_exporting_and_importing_keys"></a></h4>
<pre><code class="language-js"><span class="hljs-keyword">const</span> { subtle } = globalThis.<span class="hljs-property">crypto</span>;

<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">generateAndExportHmacKey</span>(<span class="hljs-params">format = <span class="hljs-string">'jwk'</span>, hash = <span class="hljs-string">'SHA-512'</span></span>) {
  <span class="hljs-keyword">const</span> key = <span class="hljs-keyword">await</span> subtle.<span class="hljs-title function_">generateKey</span>({
    <span class="hljs-attr">name</span>: <span class="hljs-string">'HMAC'</span>,
    hash,
  }, <span class="hljs-literal">true</span>, [<span class="hljs-string">'sign'</span>, <span class="hljs-string">'verify'</span>]);

  <span class="hljs-keyword">return</span> subtle.<span class="hljs-title function_">exportKey</span>(format, key);
}

<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">importHmacKey</span>(<span class="hljs-params">keyData, format = <span class="hljs-string">'jwk'</span>, hash = <span class="hljs-string">'SHA-512'</span></span>) {
  <span class="hljs-keyword">const</span> key = <span class="hljs-keyword">await</span> subtle.importKey(format, keyData, {
    <span class="hljs-attr">name</span>: <span class="hljs-string">'HMAC'</span>,
    hash,
  }, <span class="hljs-literal">true</span>, [<span class="hljs-string">'sign'</span>, <span class="hljs-string">'verify'</span>]);

  <span class="hljs-keyword">return</span> key;
}</code></pre>
<h4>Wrapping and unwrapping keys<span><a class="mark" href="webcrypto.html#wrapping-and-unwrapping-keys" id="wrapping-and-unwrapping-keys">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_wrapping_and_unwrapping_keys"></a></h4>
<pre><code class="language-js"><span class="hljs-keyword">const</span> { subtle } = globalThis.<span class="hljs-property">crypto</span>;

<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">generateAndWrapHmacKey</span>(<span class="hljs-params">format = <span class="hljs-string">'jwk'</span>, hash = <span class="hljs-string">'SHA-512'</span></span>) {
  <span class="hljs-keyword">const</span> [
    key,
    wrappingKey,
  ] = <span class="hljs-keyword">await</span> <span class="hljs-title class_">Promise</span>.<span class="hljs-title function_">all</span>([
    subtle.<span class="hljs-title function_">generateKey</span>({
      <span class="hljs-attr">name</span>: <span class="hljs-string">'HMAC'</span>, hash,
    }, <span class="hljs-literal">true</span>, [<span class="hljs-string">'sign'</span>, <span class="hljs-string">'verify'</span>]),
    subtle.<span class="hljs-title function_">generateKey</span>({
      <span class="hljs-attr">name</span>: <span class="hljs-string">'AES-KW'</span>,
      <span class="hljs-attr">length</span>: <span class="hljs-number">256</span>,
    }, <span class="hljs-literal">true</span>, [<span class="hljs-string">'wrapKey'</span>, <span class="hljs-string">'unwrapKey'</span>]),
  ]);

  <span class="hljs-keyword">const</span> wrappedKey = <span class="hljs-keyword">await</span> subtle.<span class="hljs-title function_">wrapKey</span>(format, key, wrappingKey, <span class="hljs-string">'AES-KW'</span>);

  <span class="hljs-keyword">return</span> { wrappedKey, wrappingKey };
}

<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">unwrapHmacKey</span>(<span class="hljs-params">
  wrappedKey,
  wrappingKey,
  format = <span class="hljs-string">'jwk'</span>,
  hash = <span class="hljs-string">'SHA-512'</span></span>) {

  <span class="hljs-keyword">const</span> key = <span class="hljs-keyword">await</span> subtle.<span class="hljs-title function_">unwrapKey</span>(
    format,
    wrappedKey,
    wrappingKey,
    <span class="hljs-string">'AES-KW'</span>,
    { <span class="hljs-attr">name</span>: <span class="hljs-string">'HMAC'</span>, hash },
    <span class="hljs-literal">true</span>,
    [<span class="hljs-string">'sign'</span>, <span class="hljs-string">'verify'</span>]);

  <span class="hljs-keyword">return</span> key;
}</code></pre>
<h4>Sign and verify<span><a class="mark" href="webcrypto.html#sign-and-verify" id="sign-and-verify">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_sign_and_verify"></a></h4>
<pre><code class="language-js"><span class="hljs-keyword">const</span> { subtle } = globalThis.<span class="hljs-property">crypto</span>;

<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">sign</span>(<span class="hljs-params">key, data</span>) {
  <span class="hljs-keyword">const</span> ec = <span class="hljs-keyword">new</span> <span class="hljs-title class_">TextEncoder</span>();
  <span class="hljs-keyword">const</span> signature =
    <span class="hljs-keyword">await</span> subtle.<span class="hljs-title function_">sign</span>(<span class="hljs-string">'RSASSA-PKCS1-v1_5'</span>, key, ec.<span class="hljs-title function_">encode</span>(data));
  <span class="hljs-keyword">return</span> signature;
}

<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">verify</span>(<span class="hljs-params">key, signature, data</span>) {
  <span class="hljs-keyword">const</span> ec = <span class="hljs-keyword">new</span> <span class="hljs-title class_">TextEncoder</span>();
  <span class="hljs-keyword">const</span> verified =
    <span class="hljs-keyword">await</span> subtle.<span class="hljs-title function_">verify</span>(
      <span class="hljs-string">'RSASSA-PKCS1-v1_5'</span>,
      key,
      signature,
      ec.<span class="hljs-title function_">encode</span>(data));
  <span class="hljs-keyword">return</span> verified;
}</code></pre>
<h4>Deriving bits and keys<span><a class="mark" href="webcrypto.html#deriving-bits-and-keys" id="deriving-bits-and-keys">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_deriving_bits_and_keys"></a></h4>
<pre><code class="language-js"><span class="hljs-keyword">const</span> { subtle } = globalThis.<span class="hljs-property">crypto</span>;

<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">pbkdf2</span>(<span class="hljs-params">pass, salt, iterations = <span class="hljs-number">1000</span>, length = <span class="hljs-number">256</span></span>) {
  <span class="hljs-keyword">const</span> ec = <span class="hljs-keyword">new</span> <span class="hljs-title class_">TextEncoder</span>();
  <span class="hljs-keyword">const</span> key = <span class="hljs-keyword">await</span> subtle.importKey(
    <span class="hljs-string">'raw'</span>,
    ec.<span class="hljs-title function_">encode</span>(pass),
    <span class="hljs-string">'PBKDF2'</span>,
    <span class="hljs-literal">false</span>,
    [<span class="hljs-string">'deriveBits'</span>]);
  <span class="hljs-keyword">const</span> bits = <span class="hljs-keyword">await</span> subtle.<span class="hljs-title function_">deriveBits</span>({
    <span class="hljs-attr">name</span>: <span class="hljs-string">'PBKDF2'</span>,
    <span class="hljs-attr">hash</span>: <span class="hljs-string">'SHA-512'</span>,
    <span class="hljs-attr">salt</span>: ec.<span class="hljs-title function_">encode</span>(salt),
    iterations,
  }, key, length);
  <span class="hljs-keyword">return</span> bits;
}

<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">pbkdf2Key</span>(<span class="hljs-params">pass, salt, iterations = <span class="hljs-number">1000</span>, length = <span class="hljs-number">256</span></span>) {
  <span class="hljs-keyword">const</span> ec = <span class="hljs-keyword">new</span> <span class="hljs-title class_">TextEncoder</span>();
  <span class="hljs-keyword">const</span> keyMaterial = <span class="hljs-keyword">await</span> subtle.importKey(
    <span class="hljs-string">'raw'</span>,
    ec.<span class="hljs-title function_">encode</span>(pass),
    <span class="hljs-string">'PBKDF2'</span>,
    <span class="hljs-literal">false</span>,
    [<span class="hljs-string">'deriveKey'</span>]);
  <span class="hljs-keyword">const</span> key = <span class="hljs-keyword">await</span> subtle.<span class="hljs-title function_">deriveKey</span>({
    <span class="hljs-attr">name</span>: <span class="hljs-string">'PBKDF2'</span>,
    <span class="hljs-attr">hash</span>: <span class="hljs-string">'SHA-512'</span>,
    <span class="hljs-attr">salt</span>: ec.<span class="hljs-title function_">encode</span>(salt),
    iterations,
  }, keyMaterial, {
    <span class="hljs-attr">name</span>: <span class="hljs-string">'AES-GCM'</span>,
    <span class="hljs-attr">length</span>: <span class="hljs-number">256</span>,
  }, <span class="hljs-literal">true</span>, [<span class="hljs-string">'encrypt'</span>, <span class="hljs-string">'decrypt'</span>]);
  <span class="hljs-keyword">return</span> key;
}</code></pre>
<h4>Digest<span><a class="mark" href="webcrypto.html#digest" id="digest">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_digest"></a></h4>
<pre><code class="language-js"><span class="hljs-keyword">const</span> { subtle } = globalThis.<span class="hljs-property">crypto</span>;

<span class="hljs-keyword">async</span> <span class="hljs-keyword">function</span> <span class="hljs-title function_">digest</span>(<span class="hljs-params">data, algorithm = <span class="hljs-string">'SHA-512'</span></span>) {
  <span class="hljs-keyword">const</span> ec = <span class="hljs-keyword">new</span> <span class="hljs-title class_">TextEncoder</span>();
  <span class="hljs-keyword">const</span> digest = <span class="hljs-keyword">await</span> subtle.<span class="hljs-title function_">digest</span>(algorithm, ec.<span class="hljs-title function_">encode</span>(data));
  <span class="hljs-keyword">return</span> digest;
}</code></pre>
</section><section><h3>Algorithm matrix<span><a class="mark" href="webcrypto.html#algorithm-matrix" id="algorithm-matrix">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_algorithm_matrix"></a></h3>
<p>The table details the algorithms supported by the Node.js Web Crypto API
implementation and the APIs supported for each:</p>
































































































































































































































































































































<table><thead><tr><th>Algorithm</th><th><code>generateKey</code></th><th><code>exportKey</code></th><th><code>importKey</code></th><th><code>encrypt</code></th><th><code>decrypt</code></th><th><code>wrapKey</code></th><th><code>unwrapKey</code></th><th><code>deriveBits</code></th><th><code>deriveKey</code></th><th><code>sign</code></th><th><code>verify</code></th><th><code>digest</code></th></tr></thead><tbody><tr><td><code>'RSASSA-PKCS1-v1_5'</code></td><td>✔</td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td><td></td></tr><tr><td><code>'RSA-PSS'</code></td><td>✔</td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td><td></td></tr><tr><td><code>'RSA-OAEP'</code></td><td>✔</td><td>✔</td><td>✔</td><td>✔</td><td>✔</td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td><code>'ECDSA'</code></td><td>✔</td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td><td></td></tr><tr><td><code>'Ed25519'</code> <span class="experimental-inline"></span><sup><a href="webcrypto.html#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></td><td>✔</td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td><td></td></tr><tr><td><code>'Ed448'</code> <span class="experimental-inline"></span><sup><a href="webcrypto.html#user-content-fn-1" id="user-content-fnref-1-2" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></td><td>✔</td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td><td></td></tr><tr><td><code>'ECDH'</code></td><td>✔</td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td><td></td><td></td><td></td></tr><tr><td><code>'X25519'</code> <span class="experimental-inline"></span><sup><a href="webcrypto.html#user-content-fn-1" id="user-content-fnref-1-3" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></td><td>✔</td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td><td></td><td></td><td></td></tr><tr><td><code>'X448'</code> <span class="experimental-inline"></span><sup><a href="webcrypto.html#user-content-fn-1" id="user-content-fnref-1-4" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></td><td>✔</td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td><td></td><td></td><td></td></tr><tr><td><code>'AES-CTR'</code></td><td>✔</td><td>✔</td><td>✔</td><td>✔</td><td>✔</td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td><code>'AES-CBC'</code></td><td>✔</td><td>✔</td><td>✔</td><td>✔</td><td>✔</td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td><code>'AES-GCM'</code></td><td>✔</td><td>✔</td><td>✔</td><td>✔</td><td>✔</td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td><code>'AES-KW'</code></td><td>✔</td><td>✔</td><td>✔</td><td></td><td></td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td><code>'HMAC'</code></td><td>✔</td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td><td></td></tr><tr><td><code>'HKDF'</code></td><td></td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td><td></td><td></td><td></td></tr><tr><td><code>'PBKDF2'</code></td><td></td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td><td></td><td></td><td></td></tr><tr><td><code>'SHA-1'</code></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>✔</td></tr><tr><td><code>'SHA-256'</code></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>✔</td></tr><tr><td><code>'SHA-384'</code></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>✔</td></tr><tr><td><code>'SHA-512'</code></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>✔</td></tr></tbody></table>
</section><section><h3>Class: <code>Crypto</code><span><a class="mark" href="webcrypto.html#class-crypto" id="class-crypto">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_crypto"></a></h3>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<p><code>globalThis.crypto</code> is an instance of the <code>Crypto</code>
class. <code>Crypto</code> is a singleton that provides access to the remainder of the
crypto API.</p>
<h4><code>crypto.subtle</code><span><a class="mark" href="webcrypto.html#cryptosubtle" id="cryptosubtle">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_crypto_subtle"></a></h4>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="webcrypto.html#class-subtlecrypto" class="type">&#x3C;SubtleCrypto></a></li>
</ul>
<p>Provides access to the <code>SubtleCrypto</code> API.</p>
<h4><code>crypto.getRandomValues(typedArray)</code><span><a class="mark" href="webcrypto.html#cryptogetrandomvaluestypedarray" id="cryptogetrandomvaluestypedarray">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_crypto_getrandomvalues_typedarray"></a></h4>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li><code>typedArray</code> <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a></li>
<li>Returns: <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a></li>
</ul>
<p>Generates cryptographically strong random values. The given <code>typedArray</code> is
filled with random values, and a reference to <code>typedArray</code> is returned.</p>
<p>The given <code>typedArray</code> must be an integer-based instance of <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a>,
i.e. <code>Float32Array</code> and <code>Float64Array</code> are not accepted.</p>
<p>An error will be thrown if the given <code>typedArray</code> is larger than 65,536 bytes.</p>
<h4><code>crypto.randomUUID()</code><span><a class="mark" href="webcrypto.html#cryptorandomuuid" id="cryptorandomuuid">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_crypto_randomuuid"></a></h4>
<div class="api_metadata">
<span>Added in: v16.7.0</span>
</div>
<ul>
<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a></li>
</ul>
<p>Generates a random <a href="https://www.rfc-editor.org/rfc/rfc4122.txt">RFC 4122</a> version 4 UUID. The UUID is generated using a
cryptographic pseudorandom number generator.</p>
</section><section><h3>Class: <code>CryptoKey</code><span><a class="mark" href="webcrypto.html#class-cryptokey" id="class-cryptokey">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_cryptokey"></a></h3>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<h4><code>cryptoKey.algorithm</code><span><a class="mark" href="webcrypto.html#cryptokeyalgorithm" id="cryptokeyalgorithm">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_cryptokey_algorithm"></a></h4>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<!--lint disable maximum-line-length remark-lint-->
<ul>
<li>Type: <a href="webcrypto.html#class-aeskeygenparams" class="type">&#x3C;AesKeyGenParams></a> | <a href="webcrypto.html#class-rsahashedkeygenparams" class="type">&#x3C;RsaHashedKeyGenParams></a> | <a href="webcrypto.html#class-eckeygenparams" class="type">&#x3C;EcKeyGenParams></a> | <a href="webcrypto.html#class-hmackeygenparams" class="type">&#x3C;HmacKeyGenParams></a></li>
</ul>
<!--lint enable maximum-line-length remark-lint-->
<p>An object detailing the algorithm for which the key can be used along with
additional algorithm-specific parameters.</p>
<p>Read-only.</p>
<h4><code>cryptoKey.extractable</code><span><a class="mark" href="webcrypto.html#cryptokeyextractable" id="cryptokeyextractable">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_cryptokey_extractable"></a></h4>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type" class="type">&#x3C;boolean></a></li>
</ul>
<p>When <code>true</code>, the <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a> can be extracted using either
<code>subtleCrypto.exportKey()</code> or <code>subtleCrypto.wrapKey()</code>.</p>
<p>Read-only.</p>
<h4><code>cryptoKey.type</code><span><a class="mark" href="webcrypto.html#cryptokeytype" id="cryptokeytype">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_cryptokey_type"></a></h4>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> One of <code>'secret'</code>, <code>'private'</code>, or <code>'public'</code>.</li>
</ul>
<p>A string identifying whether the key is a symmetric (<code>'secret'</code>) or
asymmetric (<code>'private'</code> or <code>'public'</code>) key.</p>
<h4><code>cryptoKey.usages</code><span><a class="mark" href="webcrypto.html#cryptokeyusages" id="cryptokeyusages">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_cryptokey_usages"></a></h4>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string[]></a></li>
</ul>
<p>An array of strings identifying the operations for which the
key may be used.</p>
<p>The possible usages are:</p>
<ul>
<li><code>'encrypt'</code> - The key may be used to encrypt data.</li>
<li><code>'decrypt'</code> - The key may be used to decrypt data.</li>
<li><code>'sign'</code> - The key may be used to generate digital signatures.</li>
<li><code>'verify'</code> - The key may be used to verify digital signatures.</li>
<li><code>'deriveKey'</code> - The key may be used to derive a new key.</li>
<li><code>'deriveBits'</code> - The key may be used to derive bits.</li>
<li><code>'wrapKey'</code> - The key may be used to wrap another key.</li>
<li><code>'unwrapKey'</code> - The key may be used to unwrap another key.</li>
</ul>
<p>Valid key usages depend on the key algorithm (identified by
<code>cryptokey.algorithm.name</code>).</p>
































































































































































































<table><thead><tr><th>Key Type</th><th><code>'encrypt'</code></th><th><code>'decrypt'</code></th><th><code>'sign'</code></th><th><code>'verify'</code></th><th><code>'deriveKey'</code></th><th><code>'deriveBits'</code></th><th><code>'wrapKey'</code></th><th><code>'unwrapKey'</code></th></tr></thead><tbody><tr><td><code>'AES-CBC'</code></td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td></tr><tr><td><code>'AES-CTR'</code></td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td></tr><tr><td><code>'AES-GCM'</code></td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td></tr><tr><td><code>'AES-KW'</code></td><td></td><td></td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td></tr><tr><td><code>'ECDH'</code></td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td><td></td><td></td></tr><tr><td><code>'X25519'</code> <span class="experimental-inline"></span><sup><a href="webcrypto.html#user-content-fn-1" id="user-content-fnref-1-5" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td><td></td><td></td></tr><tr><td><code>'X448'</code> <span class="experimental-inline"></span><sup><a href="webcrypto.html#user-content-fn-1" id="user-content-fnref-1-6" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td><td></td><td></td></tr><tr><td><code>'ECDSA'</code></td><td></td><td></td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td></tr><tr><td><code>'Ed25519'</code> <span class="experimental-inline"></span><sup><a href="webcrypto.html#user-content-fn-1" id="user-content-fnref-1-7" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></td><td></td><td></td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td></tr><tr><td><code>'Ed448'</code> <span class="experimental-inline"></span><sup><a href="webcrypto.html#user-content-fn-1" id="user-content-fnref-1-8" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></td><td></td><td></td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td></tr><tr><td><code>'HDKF'</code></td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td><td></td><td></td></tr><tr><td><code>'HMAC'</code></td><td></td><td></td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td></tr><tr><td><code>'PBKDF2'</code></td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td><td></td><td></td></tr><tr><td><code>'RSA-OAEP'</code></td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td><td>✔</td><td>✔</td></tr><tr><td><code>'RSA-PSS'</code></td><td></td><td></td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td></tr><tr><td><code>'RSASSA-PKCS1-v1_5'</code></td><td></td><td></td><td>✔</td><td>✔</td><td></td><td></td><td></td><td></td></tr></tbody></table>
</section><section><h3>Class: <code>CryptoKeyPair</code><span><a class="mark" href="webcrypto.html#class-cryptokeypair" id="class-cryptokeypair">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_cryptokeypair"></a></h3>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<p>The <code>CryptoKeyPair</code> is a simple dictionary object with <code>publicKey</code> and
<code>privateKey</code> properties, representing an asymmetric key pair.</p>
<h4><code>cryptoKeyPair.privateKey</code><span><a class="mark" href="webcrypto.html#cryptokeypairprivatekey" id="cryptokeypairprivatekey">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_cryptokeypair_privatekey"></a></h4>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a> A <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a> whose <code>type</code> will be <code>'private'</code>.</li>
</ul>
<h4><code>cryptoKeyPair.publicKey</code><span><a class="mark" href="webcrypto.html#cryptokeypairpublickey" id="cryptokeypairpublickey">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_cryptokeypair_publickey"></a></h4>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a> A <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a> whose <code>type</code> will be <code>'public'</code>.</li>
</ul>
</section><section><h3>Class: <code>SubtleCrypto</code><span><a class="mark" href="webcrypto.html#class-subtlecrypto" id="class-subtlecrypto">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_subtlecrypto"></a></h3>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<h4><code>subtle.decrypt(algorithm, key, data)</code><span><a class="mark" href="webcrypto.html#subtledecryptalgorithm-key-data" id="subtledecryptalgorithm-key-data">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_subtle_decrypt_algorithm_key_data"></a></h4>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li><code>algorithm</code>: <a href="webcrypto.html#class-rsaoaepparams" class="type">&#x3C;RsaOaepParams></a> | <a href="webcrypto.html#class-aesctrparams" class="type">&#x3C;AesCtrParams></a> | <a href="webcrypto.html#class-aescbcparams" class="type">&#x3C;AesCbcParams></a> | <a href="webcrypto.html#class-aesgcmparams" class="type">&#x3C;AesGcmParams></a></li>
<li><code>key</code>: <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a></li>
<li><code>data</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView" class="type">&#x3C;DataView></a> | <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a></li>
<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="type">&#x3C;Promise></a> containing <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a></li>
</ul>
<p>Using the method and parameters specified in <code>algorithm</code> and the keying
material provided by <code>key</code>, <code>subtle.decrypt()</code> attempts to decipher the
provided <code>data</code>. If successful, the returned promise will be resolved with
an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> containing the plaintext result.</p>
<p>The algorithms currently supported include:</p>
<ul>
<li><code>'RSA-OAEP'</code></li>
<li><code>'AES-CTR'</code></li>
<li><code>'AES-CBC'</code></li>
<li><code>'AES-GCM</code>'</li>
</ul>
<h4><code>subtle.deriveBits(algorithm, baseKey, length)</code><span><a class="mark" href="webcrypto.html#subtlederivebitsalgorithm-basekey-length" id="subtlederivebitsalgorithm-basekey-length">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_subtle_derivebits_algorithm_basekey_length"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v18.4.0, v16.17.0</td>
<td><p>Added <code>'X25519'</code>, and <code>'X448'</code> algorithms.</p></td></tr>
<tr><td>v15.0.0</td>
<td><p><span>Added in: v15.0.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<!--lint disable maximum-line-length remark-lint-->
<ul>
<li><code>algorithm</code>: <a href="webcrypto.html#class-algorithmidentifier" class="type">&#x3C;AlgorithmIdentifier></a> | <a href="webcrypto.html#class-ecdhkeyderiveparams" class="type">&#x3C;EcdhKeyDeriveParams></a> | <a href="webcrypto.html#class-hkdfparams" class="type">&#x3C;HkdfParams></a> | <a href="webcrypto.html#class-pbkdf2params" class="type">&#x3C;Pbkdf2Params></a></li>
<li><code>baseKey</code>: <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a></li>
<li><code>length</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&#x3C;number></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Null_type" class="type">&#x3C;null></a></li>
<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="type">&#x3C;Promise></a> containing <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a></li>
</ul>
<!--lint enable maximum-line-length remark-lint-->
<p>Using the method and parameters specified in <code>algorithm</code> and the keying
material provided by <code>baseKey</code>, <code>subtle.deriveBits()</code> attempts to generate
<code>length</code> bits.</p>
<p>The Node.js implementation requires that when <code>length</code> is a
number it must be multiple of <code>8</code>.</p>
<p>When <code>length</code> is <code>null</code> the maximum number of bits for a given algorithm is
generated. This is allowed for the <code>'ECDH'</code>, <code>'X25519'</code>, and <code>'X448'</code>
algorithms.</p>
<p>If successful, the returned promise will be resolved with an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a>
containing the generated data.</p>
<p>The algorithms currently supported include:</p>
<ul>
<li><code>'ECDH'</code></li>
<li><code>'X25519'</code> <span class="experimental-inline"></span><sup><a href="webcrypto.html#user-content-fn-1" id="user-content-fnref-1-9" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></li>
<li><code>'X448'</code> <span class="experimental-inline"></span><sup><a href="webcrypto.html#user-content-fn-1" id="user-content-fnref-1-10" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></li>
<li><code>'HKDF'</code></li>
<li><code>'PBKDF2'</code></li>
</ul>
<h4><code>subtle.deriveKey(algorithm, baseKey, derivedKeyAlgorithm, extractable, keyUsages)</code><span><a class="mark" href="webcrypto.html#subtlederivekeyalgorithm-basekey-derivedkeyalgorithm-extractable-keyusages" id="subtlederivekeyalgorithm-basekey-derivedkeyalgorithm-extractable-keyusages">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_subtle_derivekey_algorithm_basekey_derivedkeyalgorithm_extractable_keyusages"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v18.4.0, v16.17.0</td>
<td><p>Added <code>'X25519'</code>, and <code>'X448'</code> algorithms.</p></td></tr>
<tr><td>v15.0.0</td>
<td><p><span>Added in: v15.0.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<!--lint disable maximum-line-length remark-lint-->
<ul>
<li><code>algorithm</code>: <a href="webcrypto.html#class-algorithmidentifier" class="type">&#x3C;AlgorithmIdentifier></a> | <a href="webcrypto.html#class-ecdhkeyderiveparams" class="type">&#x3C;EcdhKeyDeriveParams></a> | <a href="webcrypto.html#class-hkdfparams" class="type">&#x3C;HkdfParams></a> | <a href="webcrypto.html#class-pbkdf2params" class="type">&#x3C;Pbkdf2Params></a></li>
<li><code>baseKey</code>: <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a></li>
<li><code>derivedKeyAlgorithm</code>: <a href="webcrypto.html#class-hmackeygenparams" class="type">&#x3C;HmacKeyGenParams></a> | <a href="webcrypto.html#class-aeskeygenparams" class="type">&#x3C;AesKeyGenParams></a></li>
<li><code>extractable</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type" class="type">&#x3C;boolean></a></li>
<li><code>keyUsages</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string[]></a> See <a href="webcrypto.html#cryptokeyusages">Key usages</a>.</li>
<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="type">&#x3C;Promise></a> containing <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a></li>
</ul>
<!--lint enable maximum-line-length remark-lint-->
<p>Using the method and parameters specified in <code>algorithm</code>, and the keying
material provided by <code>baseKey</code>, <code>subtle.deriveKey()</code> attempts to generate
a new <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a> based on the method and parameters in <code>derivedKeyAlgorithm</code>.</p>
<p>Calling <code>subtle.deriveKey()</code> is equivalent to calling <code>subtle.deriveBits()</code> to
generate raw keying material, then passing the result into the
<code>subtle.importKey()</code> method using the <code>deriveKeyAlgorithm</code>, <code>extractable</code>, and
<code>keyUsages</code> parameters as input.</p>
<p>The algorithms currently supported include:</p>
<ul>
<li><code>'ECDH'</code></li>
<li><code>'X25519'</code> <span class="experimental-inline"></span><sup><a href="webcrypto.html#user-content-fn-1" id="user-content-fnref-1-11" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></li>
<li><code>'X448'</code> <span class="experimental-inline"></span><sup><a href="webcrypto.html#user-content-fn-1" id="user-content-fnref-1-12" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></li>
<li><code>'HKDF'</code></li>
<li><code>'PBKDF2'</code></li>
</ul>
<h4><code>subtle.digest(algorithm, data)</code><span><a class="mark" href="webcrypto.html#subtledigestalgorithm-data" id="subtledigestalgorithm-data">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_subtle_digest_algorithm_data"></a></h4>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li><code>algorithm</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a></li>
<li><code>data</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView" class="type">&#x3C;DataView></a> | <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a></li>
<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="type">&#x3C;Promise></a> containing <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a></li>
</ul>
<p>Using the method identified by <code>algorithm</code>, <code>subtle.digest()</code> attempts to
generate a digest of <code>data</code>. If successful, the returned promise is resolved
with an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> containing the computed digest.</p>
<p>If <code>algorithm</code> is provided as a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a>, it must be one of:</p>
<ul>
<li><code>'SHA-1'</code></li>
<li><code>'SHA-256'</code></li>
<li><code>'SHA-384'</code></li>
<li><code>'SHA-512'</code></li>
</ul>
<p>If <code>algorithm</code> is provided as an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a>, it must have a <code>name</code> property
whose value is one of the above.</p>
<h4><code>subtle.encrypt(algorithm, key, data)</code><span><a class="mark" href="webcrypto.html#subtleencryptalgorithm-key-data" id="subtleencryptalgorithm-key-data">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_subtle_encrypt_algorithm_key_data"></a></h4>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li><code>algorithm</code>: <a href="webcrypto.html#class-rsaoaepparams" class="type">&#x3C;RsaOaepParams></a> | <a href="webcrypto.html#class-aesctrparams" class="type">&#x3C;AesCtrParams></a> | <a href="webcrypto.html#class-aescbcparams" class="type">&#x3C;AesCbcParams></a> | <a href="webcrypto.html#class-aesgcmparams" class="type">&#x3C;AesGcmParams></a></li>
<li><code>key</code>: <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a></li>
<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="type">&#x3C;Promise></a> containing <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a></li>
</ul>
<p>Using the method and parameters specified by <code>algorithm</code> and the keying
material provided by <code>key</code>, <code>subtle.encrypt()</code> attempts to encipher <code>data</code>.
If successful, the returned promise is resolved with an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a>
containing the encrypted result.</p>
<p>The algorithms currently supported include:</p>
<ul>
<li><code>'RSA-OAEP'</code></li>
<li><code>'AES-CTR'</code></li>
<li><code>'AES-CBC'</code></li>
<li><code>'AES-GCM</code>'</li>
</ul>
<h4><code>subtle.exportKey(format, key)</code><span><a class="mark" href="webcrypto.html#subtleexportkeyformat-key" id="subtleexportkeyformat-key">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_subtle_exportkey_format_key"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v18.4.0, v16.17.0</td>
<td><p>Added <code>'Ed25519'</code>, <code>'Ed448'</code>, <code>'X25519'</code>, and <code>'X448'</code> algorithms.</p></td></tr>
<tr><td>v15.9.0</td>
<td><p>Removed <code>'NODE-DSA'</code> JWK export.</p></td></tr>
<tr><td>v15.0.0</td>
<td><p><span>Added in: v15.0.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<ul>
<li><code>format</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be one of <code>'raw'</code>, <code>'pkcs8'</code>, <code>'spki'</code>, or <code>'jwk'</code>.</li>
<li><code>key</code>: <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a></li>
<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="type">&#x3C;Promise></a> containing <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a>.</li>
</ul>
<p>Exports the given key into the specified format, if supported.</p>
<p>If the <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a> is not extractable, the returned promise will reject.</p>
<p>When <code>format</code> is either <code>'pkcs8'</code> or <code>'spki'</code> and the export is successful,
the returned promise will be resolved with an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> containing the
exported key data.</p>
<p>When <code>format</code> is <code>'jwk'</code> and the export is successful, the returned promise
will be resolved with a JavaScript object conforming to the <a href="https://tools.ietf.org/html/rfc7517">JSON Web Key</a>
specification.</p>














































































































<table><thead><tr><th>Key Type</th><th><code>'spki'</code></th><th><code>'pkcs8'</code></th><th><code>'jwk'</code></th><th><code>'raw'</code></th></tr></thead><tbody><tr><td><code>'AES-CBC'</code></td><td></td><td></td><td>✔</td><td>✔</td></tr><tr><td><code>'AES-CTR'</code></td><td></td><td></td><td>✔</td><td>✔</td></tr><tr><td><code>'AES-GCM'</code></td><td></td><td></td><td>✔</td><td>✔</td></tr><tr><td><code>'AES-KW'</code></td><td></td><td></td><td>✔</td><td>✔</td></tr><tr><td><code>'ECDH'</code></td><td>✔</td><td>✔</td><td>✔</td><td>✔</td></tr><tr><td><code>'ECDSA'</code></td><td>✔</td><td>✔</td><td>✔</td><td>✔</td></tr><tr><td><code>'Ed25519'</code> <span class="experimental-inline"></span><sup><a href="webcrypto.html#user-content-fn-1" id="user-content-fnref-1-13" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></td><td>✔</td><td>✔</td><td>✔</td><td>✔</td></tr><tr><td><code>'Ed448'</code> <span class="experimental-inline"></span><sup><a href="webcrypto.html#user-content-fn-1" id="user-content-fnref-1-14" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></td><td>✔</td><td>✔</td><td>✔</td><td>✔</td></tr><tr><td><code>'HDKF'</code></td><td></td><td></td><td></td><td></td></tr><tr><td><code>'HMAC'</code></td><td></td><td></td><td>✔</td><td>✔</td></tr><tr><td><code>'PBKDF2'</code></td><td></td><td></td><td></td><td></td></tr><tr><td><code>'RSA-OAEP'</code></td><td>✔</td><td>✔</td><td>✔</td><td></td></tr><tr><td><code>'RSA-PSS'</code></td><td>✔</td><td>✔</td><td>✔</td><td></td></tr><tr><td><code>'RSASSA-PKCS1-v1_5'</code></td><td>✔</td><td>✔</td><td>✔</td><td></td></tr></tbody></table>
<h4><code>subtle.generateKey(algorithm, extractable, keyUsages)</code><span><a class="mark" href="webcrypto.html#subtlegeneratekeyalgorithm-extractable-keyusages" id="subtlegeneratekeyalgorithm-extractable-keyusages">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_subtle_generatekey_algorithm_extractable_keyusages"></a></h4>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<!--lint disable maximum-line-length remark-lint-->
<ul>
<li><code>algorithm</code>: <a href="webcrypto.html#class-algorithmidentifier" class="type">&#x3C;AlgorithmIdentifier></a> | <a href="webcrypto.html#class-rsahashedkeygenparams" class="type">&#x3C;RsaHashedKeyGenParams></a> | <a href="webcrypto.html#class-eckeygenparams" class="type">&#x3C;EcKeyGenParams></a> | <a href="webcrypto.html#class-hmackeygenparams" class="type">&#x3C;HmacKeyGenParams></a> | <a href="webcrypto.html#class-aeskeygenparams" class="type">&#x3C;AesKeyGenParams></a></li>
</ul>
<!--lint enable maximum-line-length remark-lint-->
<ul>
<li><code>extractable</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type" class="type">&#x3C;boolean></a></li>
<li><code>keyUsages</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string[]></a> See <a href="webcrypto.html#cryptokeyusages">Key usages</a>.</li>
<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="type">&#x3C;Promise></a> containing <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a> | <a href="webcrypto.html#class-cryptokeypair" class="type">&#x3C;CryptoKeyPair></a></li>
</ul>
<p>Using the method and parameters provided in <code>algorithm</code>, <code>subtle.generateKey()</code>
attempts to generate new keying material. Depending the method used, the method
may generate either a single <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a> or a <a href="webcrypto.html#class-cryptokeypair" class="type">&#x3C;CryptoKeyPair></a>.</p>
<p>The <a href="webcrypto.html#class-cryptokeypair" class="type">&#x3C;CryptoKeyPair></a> (public and private key) generating algorithms supported
include:</p>
<ul>
<li><code>'RSASSA-PKCS1-v1_5'</code></li>
<li><code>'RSA-PSS'</code></li>
<li><code>'RSA-OAEP'</code></li>
<li><code>'ECDSA'</code></li>
<li><code>'Ed25519'</code> <span class="experimental-inline"></span><sup><a href="webcrypto.html#user-content-fn-1" id="user-content-fnref-1-15" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></li>
<li><code>'Ed448'</code> <span class="experimental-inline"></span><sup><a href="webcrypto.html#user-content-fn-1" id="user-content-fnref-1-16" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></li>
<li><code>'ECDH'</code></li>
<li><code>'X25519'</code> <span class="experimental-inline"></span><sup><a href="webcrypto.html#user-content-fn-1" id="user-content-fnref-1-17" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></li>
<li><code>'X448'</code> <span class="experimental-inline"></span><sup><a href="webcrypto.html#user-content-fn-1" id="user-content-fnref-1-18" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></li>
</ul>
<p>The <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a> (secret key) generating algorithms supported include:</p>
<ul>
<li><code>'HMAC'</code></li>
<li><code>'AES-CTR'</code></li>
<li><code>'AES-CBC'</code></li>
<li><code>'AES-GCM'</code></li>
<li><code>'AES-KW'</code></li>
</ul>
<h4><code>subtle.importKey(format, keyData, algorithm, extractable, keyUsages)</code><span><a class="mark" href="webcrypto.html#subtleimportkeyformat-keydata-algorithm-extractable-keyusages" id="subtleimportkeyformat-keydata-algorithm-extractable-keyusages">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_subtle_importkey_format_keydata_algorithm_extractable_keyusages"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v18.4.0, v16.17.0</td>
<td><p>Added <code>'Ed25519'</code>, <code>'Ed448'</code>, <code>'X25519'</code>, and <code>'X448'</code> algorithms.</p></td></tr>
<tr><td>v15.9.0</td>
<td><p>Removed <code>'NODE-DSA'</code> JWK import.</p></td></tr>
<tr><td>v15.0.0</td>
<td><p><span>Added in: v15.0.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<ul>
<li><code>format</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be one of <code>'raw'</code>, <code>'pkcs8'</code>, <code>'spki'</code>, or <code>'jwk'</code>.</li>
<li><code>keyData</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView" class="type">&#x3C;DataView></a> | <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a></li>
</ul>
<!--lint disable maximum-line-length remark-lint-->
<ul>
<li><code>algorithm</code>: <a href="webcrypto.html#class-algorithmidentifier" class="type">&#x3C;AlgorithmIdentifier></a> | <a href="webcrypto.html#class-rsahashedimportparams" class="type">&#x3C;RsaHashedImportParams></a> | <a href="webcrypto.html#class-eckeyimportparams" class="type">&#x3C;EcKeyImportParams></a> | <a href="webcrypto.html#class-hmacimportparams" class="type">&#x3C;HmacImportParams></a></li>
</ul>
<!--lint enable maximum-line-length remark-lint-->
<ul>
<li><code>extractable</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type" class="type">&#x3C;boolean></a></li>
<li><code>keyUsages</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string[]></a> See <a href="webcrypto.html#cryptokeyusages">Key usages</a>.</li>
<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="type">&#x3C;Promise></a> containing <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a></li>
</ul>
<p>The <code>subtle.importKey()</code> method attempts to interpret the provided <code>keyData</code>
as the given <code>format</code> to create a <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a> instance using the provided
<code>algorithm</code>, <code>extractable</code>, and <code>keyUsages</code> arguments. If the import is
successful, the returned promise will be resolved with the created <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a>.</p>
<p>If importing a <code>'PBKDF2'</code> key, <code>extractable</code> must be <code>false</code>.</p>
<p>The algorithms currently supported include:</p>




























































































































<table><thead><tr><th>Key Type</th><th><code>'spki'</code></th><th><code>'pkcs8'</code></th><th><code>'jwk'</code></th><th><code>'raw'</code></th></tr></thead><tbody><tr><td><code>'AES-CBC'</code></td><td></td><td></td><td>✔</td><td>✔</td></tr><tr><td><code>'AES-CTR'</code></td><td></td><td></td><td>✔</td><td>✔</td></tr><tr><td><code>'AES-GCM'</code></td><td></td><td></td><td>✔</td><td>✔</td></tr><tr><td><code>'AES-KW'</code></td><td></td><td></td><td>✔</td><td>✔</td></tr><tr><td><code>'ECDH'</code></td><td>✔</td><td>✔</td><td>✔</td><td>✔</td></tr><tr><td><code>'X25519'</code> <span class="experimental-inline"></span><sup><a href="webcrypto.html#user-content-fn-1" id="user-content-fnref-1-19" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></td><td>✔</td><td>✔</td><td>✔</td><td>✔</td></tr><tr><td><code>'X448'</code> <span class="experimental-inline"></span><sup><a href="webcrypto.html#user-content-fn-1" id="user-content-fnref-1-20" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></td><td>✔</td><td>✔</td><td>✔</td><td>✔</td></tr><tr><td><code>'ECDSA'</code></td><td>✔</td><td>✔</td><td>✔</td><td>✔</td></tr><tr><td><code>'Ed25519'</code> <span class="experimental-inline"></span><sup><a href="webcrypto.html#user-content-fn-1" id="user-content-fnref-1-21" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></td><td>✔</td><td>✔</td><td>✔</td><td>✔</td></tr><tr><td><code>'Ed448'</code> <span class="experimental-inline"></span><sup><a href="webcrypto.html#user-content-fn-1" id="user-content-fnref-1-22" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></td><td>✔</td><td>✔</td><td>✔</td><td>✔</td></tr><tr><td><code>'HDKF'</code></td><td></td><td></td><td></td><td>✔</td></tr><tr><td><code>'HMAC'</code></td><td></td><td></td><td>✔</td><td>✔</td></tr><tr><td><code>'PBKDF2'</code></td><td></td><td></td><td></td><td>✔</td></tr><tr><td><code>'RSA-OAEP'</code></td><td>✔</td><td>✔</td><td>✔</td><td></td></tr><tr><td><code>'RSA-PSS'</code></td><td>✔</td><td>✔</td><td>✔</td><td></td></tr><tr><td><code>'RSASSA-PKCS1-v1_5'</code></td><td>✔</td><td>✔</td><td>✔</td><td></td></tr></tbody></table>
<h4><code>subtle.sign(algorithm, key, data)</code><span><a class="mark" href="webcrypto.html#subtlesignalgorithm-key-data" id="subtlesignalgorithm-key-data">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_subtle_sign_algorithm_key_data"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v18.4.0, v16.17.0</td>
<td><p>Added <code>'Ed25519'</code>, and <code>'Ed448'</code> algorithms.</p></td></tr>
<tr><td>v15.0.0</td>
<td><p><span>Added in: v15.0.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<!--lint disable maximum-line-length remark-lint-->
<ul>
<li><code>algorithm</code>: <a href="webcrypto.html#class-algorithmidentifier" class="type">&#x3C;AlgorithmIdentifier></a> | <a href="webcrypto.html#class-rsapssparams" class="type">&#x3C;RsaPssParams></a> | <a href="webcrypto.html#class-ecdsaparams" class="type">&#x3C;EcdsaParams></a> | <a href="webcrypto.html#class-ed448params" class="type">&#x3C;Ed448Params></a></li>
<li><code>key</code>: <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a></li>
<li><code>data</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView" class="type">&#x3C;DataView></a> | <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a></li>
<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="type">&#x3C;Promise></a> containing <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a></li>
</ul>
<!--lint enable maximum-line-length remark-lint-->
<p>Using the method and parameters given by <code>algorithm</code> and the keying material
provided by <code>key</code>, <code>subtle.sign()</code> attempts to generate a cryptographic
signature of <code>data</code>. If successful, the returned promise is resolved with
an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> containing the generated signature.</p>
<p>The algorithms currently supported include:</p>
<ul>
<li><code>'RSASSA-PKCS1-v1_5'</code></li>
<li><code>'RSA-PSS'</code></li>
<li><code>'ECDSA'</code></li>
<li><code>'Ed25519'</code> <span class="experimental-inline"></span><sup><a href="webcrypto.html#user-content-fn-1" id="user-content-fnref-1-23" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></li>
<li><code>'Ed448'</code> <span class="experimental-inline"></span><sup><a href="webcrypto.html#user-content-fn-1" id="user-content-fnref-1-24" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></li>
<li><code>'HMAC'</code></li>
</ul>
<h4><code>subtle.unwrapKey(format, wrappedKey, unwrappingKey, unwrapAlgo, unwrappedKeyAlgo, extractable, keyUsages)</code><span><a class="mark" href="webcrypto.html#subtleunwrapkeyformat-wrappedkey-unwrappingkey-unwrapalgo-unwrappedkeyalgo-extractable-keyusages" id="subtleunwrapkeyformat-wrappedkey-unwrappingkey-unwrapalgo-unwrappedkeyalgo-extractable-keyusages">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_subtle_unwrapkey_format_wrappedkey_unwrappingkey_unwrapalgo_unwrappedkeyalgo_extractable_keyusages"></a></h4>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li><code>format</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be one of <code>'raw'</code>, <code>'pkcs8'</code>, <code>'spki'</code>, or <code>'jwk'</code>.</li>
<li><code>wrappedKey</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView" class="type">&#x3C;DataView></a> | <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a></li>
<li><code>unwrappingKey</code>: <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a></li>
</ul>
<!--lint disable maximum-line-length remark-lint-->
<ul>
<li><code>unwrapAlgo</code>: <a href="webcrypto.html#class-algorithmidentifier" class="type">&#x3C;AlgorithmIdentifier></a> | <a href="webcrypto.html#class-rsaoaepparams" class="type">&#x3C;RsaOaepParams></a> | <a href="webcrypto.html#class-aesctrparams" class="type">&#x3C;AesCtrParams></a> | <a href="webcrypto.html#class-aescbcparams" class="type">&#x3C;AesCbcParams></a> | <a href="webcrypto.html#class-aesgcmparams" class="type">&#x3C;AesGcmParams></a></li>
<li><code>unwrappedKeyAlgo</code>: <a href="webcrypto.html#class-algorithmidentifier" class="type">&#x3C;AlgorithmIdentifier></a> | <a href="webcrypto.html#class-rsahashedimportparams" class="type">&#x3C;RsaHashedImportParams></a> | <a href="webcrypto.html#class-eckeyimportparams" class="type">&#x3C;EcKeyImportParams></a> | <a href="webcrypto.html#class-hmacimportparams" class="type">&#x3C;HmacImportParams></a></li>
</ul>
<!--lint enable maximum-line-length remark-lint-->
<ul>
<li><code>extractable</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type" class="type">&#x3C;boolean></a></li>
<li><code>keyUsages</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string[]></a> See <a href="webcrypto.html#cryptokeyusages">Key usages</a>.</li>
<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="type">&#x3C;Promise></a> containing <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a></li>
</ul>
<p>In cryptography, "wrapping a key" refers to exporting and then encrypting the
keying material. The <code>subtle.unwrapKey()</code> method attempts to decrypt a wrapped
key and create a <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a> instance. It is equivalent to calling
<code>subtle.decrypt()</code> first on the encrypted key data (using the <code>wrappedKey</code>,
<code>unwrapAlgo</code>, and <code>unwrappingKey</code> arguments as input) then passing the results
in to the <code>subtle.importKey()</code> method using the <code>unwrappedKeyAlgo</code>,
<code>extractable</code>, and <code>keyUsages</code> arguments as inputs. If successful, the returned
promise is resolved with a <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a> object.</p>
<p>The wrapping algorithms currently supported include:</p>
<ul>
<li><code>'RSA-OAEP'</code></li>
<li><code>'AES-CTR'</code></li>
<li><code>'AES-CBC'</code></li>
<li><code>'AES-GCM'</code></li>
<li><code>'AES-KW'</code></li>
</ul>
<p>The unwrapped key algorithms supported include:</p>
<ul>
<li><code>'RSASSA-PKCS1-v1_5'</code></li>
<li><code>'RSA-PSS'</code></li>
<li><code>'RSA-OAEP'</code></li>
<li><code>'ECDSA'</code></li>
<li><code>'Ed25519'</code> <span class="experimental-inline"></span><sup><a href="webcrypto.html#user-content-fn-1" id="user-content-fnref-1-25" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></li>
<li><code>'Ed448'</code> <span class="experimental-inline"></span><sup><a href="webcrypto.html#user-content-fn-1" id="user-content-fnref-1-26" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></li>
<li><code>'ECDH'</code></li>
<li><code>'X25519'</code> <span class="experimental-inline"></span><sup><a href="webcrypto.html#user-content-fn-1" id="user-content-fnref-1-27" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></li>
<li><code>'X448'</code> <span class="experimental-inline"></span><sup><a href="webcrypto.html#user-content-fn-1" id="user-content-fnref-1-28" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></li>
<li><code>'HMAC'</code></li>
<li><code>'AES-CTR'</code></li>
<li><code>'AES-CBC'</code></li>
<li><code>'AES-GCM'</code></li>
<li><code>'AES-KW'</code></li>
</ul>
<h4><code>subtle.verify(algorithm, key, signature, data)</code><span><a class="mark" href="webcrypto.html#subtleverifyalgorithm-key-signature-data" id="subtleverifyalgorithm-key-signature-data">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_subtle_verify_algorithm_key_signature_data"></a></h4>
<div class="api_metadata">
<details class="changelog"><summary>History</summary>
<table>
<tbody><tr><th>Version</th><th>Changes</th></tr>
<tr><td>v18.4.0, v16.17.0</td>
<td><p>Added <code>'Ed25519'</code>, and <code>'Ed448'</code> algorithms.</p></td></tr>
<tr><td>v15.0.0</td>
<td><p><span>Added in: v15.0.0</span></p></td></tr>
</tbody></table>
</details>
</div>
<!--lint disable maximum-line-length remark-lint-->
<ul>
<li><code>algorithm</code>: <a href="webcrypto.html#class-algorithmidentifier" class="type">&#x3C;AlgorithmIdentifier></a> | <a href="webcrypto.html#class-rsapssparams" class="type">&#x3C;RsaPssParams></a> | <a href="webcrypto.html#class-ecdsaparams" class="type">&#x3C;EcdsaParams></a> | <a href="webcrypto.html#class-ed448params" class="type">&#x3C;Ed448Params></a></li>
<li><code>key</code>: <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a></li>
<li><code>signature</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView" class="type">&#x3C;DataView></a> | <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a></li>
<li><code>data</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView" class="type">&#x3C;DataView></a> | <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a></li>
<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="type">&#x3C;Promise></a> containing <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type" class="type">&#x3C;boolean></a></li>
</ul>
<!--lint enable maximum-line-length remark-lint-->
<p>Using the method and parameters given in <code>algorithm</code> and the keying material
provided by <code>key</code>, <code>subtle.verify()</code> attempts to verify that <code>signature</code> is
a valid cryptographic signature of <code>data</code>. The returned promise is resolved
with either <code>true</code> or <code>false</code>.</p>
<p>The algorithms currently supported include:</p>
<ul>
<li><code>'RSASSA-PKCS1-v1_5'</code></li>
<li><code>'RSA-PSS'</code></li>
<li><code>'ECDSA'</code></li>
<li><code>'Ed25519'</code> <span class="experimental-inline"></span><sup><a href="webcrypto.html#user-content-fn-1" id="user-content-fnref-1-29" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></li>
<li><code>'Ed448'</code> <span class="experimental-inline"></span><sup><a href="webcrypto.html#user-content-fn-1" id="user-content-fnref-1-30" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></li>
<li><code>'HMAC'</code></li>
</ul>
<h4><code>subtle.wrapKey(format, key, wrappingKey, wrapAlgo)</code><span><a class="mark" href="webcrypto.html#subtlewrapkeyformat-key-wrappingkey-wrapalgo" id="subtlewrapkeyformat-key-wrappingkey-wrapalgo">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_subtle_wrapkey_format_key_wrappingkey_wrapalgo"></a></h4>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<!--lint disable maximum-line-length remark-lint-->
<ul>
<li><code>format</code>: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be one of <code>'raw'</code>, <code>'pkcs8'</code>, <code>'spki'</code>, or <code>'jwk'</code>.</li>
<li><code>key</code>: <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a></li>
<li><code>wrappingKey</code>: <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a></li>
<li><code>wrapAlgo</code>: <a href="webcrypto.html#class-algorithmidentifier" class="type">&#x3C;AlgorithmIdentifier></a> | <a href="webcrypto.html#class-rsaoaepparams" class="type">&#x3C;RsaOaepParams></a> | <a href="webcrypto.html#class-aesctrparams" class="type">&#x3C;AesCtrParams></a> | <a href="webcrypto.html#class-aescbcparams" class="type">&#x3C;AesCbcParams></a> | <a href="webcrypto.html#class-aesgcmparams" class="type">&#x3C;AesGcmParams></a></li>
<li>Returns: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="type">&#x3C;Promise></a> containing <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a></li>
</ul>
<!--lint enable maximum-line-length remark-lint-->
<p>In cryptography, "wrapping a key" refers to exporting and then encrypting the
keying material. The <code>subtle.wrapKey()</code> method exports the keying material into
the format identified by <code>format</code>, then encrypts it using the method and
parameters specified by <code>wrapAlgo</code> and the keying material provided by
<code>wrappingKey</code>. It is the equivalent to calling <code>subtle.exportKey()</code> using
<code>format</code> and <code>key</code> as the arguments, then passing the result to the
<code>subtle.encrypt()</code> method using <code>wrappingKey</code> and <code>wrapAlgo</code> as inputs. If
successful, the returned promise will be resolved with an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a>
containing the encrypted key data.</p>
<p>The wrapping algorithms currently supported include:</p>
<ul>
<li><code>'RSA-OAEP'</code></li>
<li><code>'AES-CTR'</code></li>
<li><code>'AES-CBC'</code></li>
<li><code>'AES-GCM'</code></li>
<li><code>'AES-KW'</code></li>
</ul>
</section><section><h3>Algorithm parameters<span><a class="mark" href="webcrypto.html#algorithm-parameters" id="algorithm-parameters">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_algorithm_parameters"></a></h3>
<p>The algorithm parameter objects define the methods and parameters used by
the various <a href="webcrypto.html#class-subtlecrypto" class="type">&#x3C;SubtleCrypto></a> methods. While described here as "classes", they
are simple JavaScript dictionary objects.</p>
<h4>Class: <code>AlgorithmIdentifier</code><span><a class="mark" href="webcrypto.html#class-algorithmidentifier" id="class-algorithmidentifier">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_algorithmidentifier"></a></h4>
<div class="api_metadata">
<span>Added in: v18.4.0, v16.17.0</span>
</div>
<h5><code>algorithmIdentifier.name</code><span><a class="mark" href="webcrypto.html#algorithmidentifiername" id="algorithmidentifiername">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_algorithmidentifier_name"></a></h5>
<div class="api_metadata">
<span>Added in: v18.4.0, v16.17.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a></li>
</ul>
<h4>Class: <code>AesCbcParams</code><span><a class="mark" href="webcrypto.html#class-aescbcparams" id="class-aescbcparams">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_aescbcparams"></a></h4>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<h5><code>aesCbcParams.iv</code><span><a class="mark" href="webcrypto.html#aescbcparamsiv" id="aescbcparamsiv">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_aescbcparams_iv"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView" class="type">&#x3C;DataView></a> | <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a></li>
</ul>
<p>Provides the initialization vector. It must be exactly 16-bytes in length
and should be unpredictable and cryptographically random.</p>
<h5><code>aesCbcParams.name</code><span><a class="mark" href="webcrypto.html#aescbcparamsname" id="aescbcparamsname">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_aescbcparams_name"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be <code>'AES-CBC'</code>.</li>
</ul>
<h4>Class: <code>AesCtrParams</code><span><a class="mark" href="webcrypto.html#class-aesctrparams" id="class-aesctrparams">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_aesctrparams"></a></h4>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<h5><code>aesCtrParams.counter</code><span><a class="mark" href="webcrypto.html#aesctrparamscounter" id="aesctrparamscounter">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_aesctrparams_counter"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView" class="type">&#x3C;DataView></a> | <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a></li>
</ul>
<p>The initial value of the counter block. This must be exactly 16 bytes long.</p>
<p>The <code>AES-CTR</code> method uses the rightmost <code>length</code> bits of the block as the
counter and the remaining bits as the nonce.</p>
<h5><code>aesCtrParams.length</code><span><a class="mark" href="webcrypto.html#aesctrparamslength" id="aesctrparamslength">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_aesctrparams_length"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&#x3C;number></a> The number of bits in the <code>aesCtrParams.counter</code> that are
to be used as the counter.</li>
</ul>
<h5><code>aesCtrParams.name</code><span><a class="mark" href="webcrypto.html#aesctrparamsname" id="aesctrparamsname">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_aesctrparams_name"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be <code>'AES-CTR'</code>.</li>
</ul>
<h4>Class: <code>AesGcmParams</code><span><a class="mark" href="webcrypto.html#class-aesgcmparams" id="class-aesgcmparams">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_aesgcmparams"></a></h4>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<h5><code>aesGcmParams.additionalData</code><span><a class="mark" href="webcrypto.html#aesgcmparamsadditionaldata" id="aesgcmparamsadditionaldata">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_aesgcmparams_additionaldata"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView" class="type">&#x3C;DataView></a> | <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type" class="type">&#x3C;undefined></a></li>
</ul>
<p>With the AES-GCM method, the <code>additionalData</code> is extra input that is not
encrypted but is included in the authentication of the data. The use of
<code>additionalData</code> is optional.</p>
<h5><code>aesGcmParams.iv</code><span><a class="mark" href="webcrypto.html#aesgcmparamsiv" id="aesgcmparamsiv">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_aesgcmparams_iv"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView" class="type">&#x3C;DataView></a> | <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a></li>
</ul>
<p>The initialization vector must be unique for every encryption operation using a
given key.</p>
<p>Ideally, this is a deterministic 12-byte value that is computed in such a way
that it is guaranteed to be unique across all invocations that use the same key.
Alternatively, the initialization vector may consist of at least 12
cryptographically random bytes. For more information on constructing
initialization vectors for AES-GCM, refer to Section 8 of <a href="https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf">NIST SP 800-38D</a>.</p>
<h5><code>aesGcmParams.name</code><span><a class="mark" href="webcrypto.html#aesgcmparamsname" id="aesgcmparamsname">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_aesgcmparams_name"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be <code>'AES-GCM'</code>.</li>
</ul>
<h5><code>aesGcmParams.tagLength</code><span><a class="mark" href="webcrypto.html#aesgcmparamstaglength" id="aesgcmparamstaglength">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_aesgcmparams_taglength"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&#x3C;number></a> The size in bits of the generated authentication tag.
This values must be one of <code>32</code>, <code>64</code>, <code>96</code>, <code>104</code>, <code>112</code>, <code>120</code>, or
<code>128</code>. <strong>Default:</strong> <code>128</code>.</li>
</ul>
<h4>Class: <code>AesKeyGenParams</code><span><a class="mark" href="webcrypto.html#class-aeskeygenparams" id="class-aeskeygenparams">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_aeskeygenparams"></a></h4>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<h5><code>aesKeyGenParams.length</code><span><a class="mark" href="webcrypto.html#aeskeygenparamslength" id="aeskeygenparamslength">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_aeskeygenparams_length"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&#x3C;number></a></li>
</ul>
<p>The length of the AES key to be generated. This must be either <code>128</code>, <code>192</code>,
or <code>256</code>.</p>
<h5><code>aesKeyGenParams.name</code><span><a class="mark" href="webcrypto.html#aeskeygenparamsname" id="aeskeygenparamsname">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_aeskeygenparams_name"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be one of <code>'AES-CBC'</code>, <code>'AES-CTR'</code>, <code>'AES-GCM'</code>, or
<code>'AES-KW'</code></li>
</ul>
<h4>Class: <code>EcdhKeyDeriveParams</code><span><a class="mark" href="webcrypto.html#class-ecdhkeyderiveparams" id="class-ecdhkeyderiveparams">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_ecdhkeyderiveparams"></a></h4>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<h5><code>ecdhKeyDeriveParams.name</code><span><a class="mark" href="webcrypto.html#ecdhkeyderiveparamsname" id="ecdhkeyderiveparamsname">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_ecdhkeyderiveparams_name"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be <code>'ECDH'</code>, <code>'X25519'</code>, or <code>'X448'</code>.</li>
</ul>
<h5><code>ecdhKeyDeriveParams.public</code><span><a class="mark" href="webcrypto.html#ecdhkeyderiveparamspublic" id="ecdhkeyderiveparamspublic">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_ecdhkeyderiveparams_public"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="webcrypto.html#class-cryptokey" class="type">&#x3C;CryptoKey></a></li>
</ul>
<p>ECDH key derivation operates by taking as input one parties private key and
another parties public key -- using both to generate a common shared secret.
The <code>ecdhKeyDeriveParams.public</code> property is set to the other parties public
key.</p>
<h4>Class: <code>EcdsaParams</code><span><a class="mark" href="webcrypto.html#class-ecdsaparams" id="class-ecdsaparams">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_ecdsaparams"></a></h4>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<h5><code>ecdsaParams.hash</code><span><a class="mark" href="webcrypto.html#ecdsaparamshash" id="ecdsaparamshash">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_ecdsaparams_hash"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a></li>
</ul>
<p>If represented as a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a>, the value must be one of:</p>
<ul>
<li><code>'SHA-1'</code></li>
<li><code>'SHA-256'</code></li>
<li><code>'SHA-384'</code></li>
<li><code>'SHA-512'</code></li>
</ul>
<p>If represented as an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a>, the object must have a <code>name</code> property
whose value is one of the above listed values.</p>
<h5><code>ecdsaParams.name</code><span><a class="mark" href="webcrypto.html#ecdsaparamsname" id="ecdsaparamsname">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_ecdsaparams_name"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be <code>'ECDSA'</code>.</li>
</ul>
<h4>Class: <code>EcKeyGenParams</code><span><a class="mark" href="webcrypto.html#class-eckeygenparams" id="class-eckeygenparams">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_eckeygenparams"></a></h4>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<h5><code>ecKeyGenParams.name</code><span><a class="mark" href="webcrypto.html#eckeygenparamsname" id="eckeygenparamsname">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_eckeygenparams_name"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be one of <code>'ECDSA'</code> or <code>'ECDH'</code>.</li>
</ul>
<h5><code>ecKeyGenParams.namedCurve</code><span><a class="mark" href="webcrypto.html#eckeygenparamsnamedcurve" id="eckeygenparamsnamedcurve">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_eckeygenparams_namedcurve"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be one of <code>'P-256'</code>, <code>'P-384'</code>, <code>'P-521'</code>.</li>
</ul>
<h4>Class: <code>EcKeyImportParams</code><span><a class="mark" href="webcrypto.html#class-eckeyimportparams" id="class-eckeyimportparams">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_eckeyimportparams"></a></h4>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<h5><code>ecKeyImportParams.name</code><span><a class="mark" href="webcrypto.html#eckeyimportparamsname" id="eckeyimportparamsname">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_eckeyimportparams_name"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be one of <code>'ECDSA'</code> or <code>'ECDH'</code>.</li>
</ul>
<h5><code>ecKeyImportParams.namedCurve</code><span><a class="mark" href="webcrypto.html#eckeyimportparamsnamedcurve" id="eckeyimportparamsnamedcurve">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_eckeyimportparams_namedcurve"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be one of <code>'P-256'</code>, <code>'P-384'</code>, <code>'P-521'</code>.</li>
</ul>
<h4>Class: <code>Ed448Params</code><span><a class="mark" href="webcrypto.html#class-ed448params" id="class-ed448params">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_ed448params"></a></h4>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<h5><code>ed448Params.name</code><span><a class="mark" href="webcrypto.html#ed448paramsname" id="ed448paramsname">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_ed448params_name"></a></h5>
<div class="api_metadata">
<span>Added in: v18.4.0, v16.17.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be <code>'Ed448'</code>.</li>
</ul>
<h5><code>ed448Params.context</code><span><a class="mark" href="webcrypto.html#ed448paramscontext" id="ed448paramscontext">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_ed448params_context"></a></h5>
<div class="api_metadata">
<span>Added in: v18.4.0, v16.17.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView" class="type">&#x3C;DataView></a> | <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type" class="type">&#x3C;undefined></a></li>
</ul>
<p>The <code>context</code> member represents the optional context data to associate with
the message.
The Node.js Web Crypto API implementation only supports zero-length context
which is equivalent to not providing context at all.</p>
<h4>Class: <code>HkdfParams</code><span><a class="mark" href="webcrypto.html#class-hkdfparams" id="class-hkdfparams">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_hkdfparams"></a></h4>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<h5><code>hkdfParams.hash</code><span><a class="mark" href="webcrypto.html#hkdfparamshash" id="hkdfparamshash">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_hkdfparams_hash"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a></li>
</ul>
<p>If represented as a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a>, the value must be one of:</p>
<ul>
<li><code>'SHA-1'</code></li>
<li><code>'SHA-256'</code></li>
<li><code>'SHA-384'</code></li>
<li><code>'SHA-512'</code></li>
</ul>
<p>If represented as an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a>, the object must have a <code>name</code> property
whose value is one of the above listed values.</p>
<h5><code>hkdfParams.info</code><span><a class="mark" href="webcrypto.html#hkdfparamsinfo" id="hkdfparamsinfo">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_hkdfparams_info"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView" class="type">&#x3C;DataView></a> | <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a></li>
</ul>
<p>Provides application-specific contextual input to the HKDF algorithm.
This can be zero-length but must be provided.</p>
<h5><code>hkdfParams.name</code><span><a class="mark" href="webcrypto.html#hkdfparamsname" id="hkdfparamsname">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_hkdfparams_name"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be <code>'HKDF'</code>.</li>
</ul>
<h5><code>hkdfParams.salt</code><span><a class="mark" href="webcrypto.html#hkdfparamssalt" id="hkdfparamssalt">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_hkdfparams_salt"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView" class="type">&#x3C;DataView></a> | <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a></li>
</ul>
<p>The salt value significantly improves the strength of the HKDF algorithm.
It should be random or pseudorandom and should be the same length as the
output of the digest function (for instance, if using <code>'SHA-256'</code> as the
digest, the salt should be 256-bits of random data).</p>
<h4>Class: <code>HmacImportParams</code><span><a class="mark" href="webcrypto.html#class-hmacimportparams" id="class-hmacimportparams">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_hmacimportparams"></a></h4>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<h5><code>hmacImportParams.hash</code><span><a class="mark" href="webcrypto.html#hmacimportparamshash" id="hmacimportparamshash">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_hmacimportparams_hash"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a></li>
</ul>
<p>If represented as a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a>, the value must be one of:</p>
<ul>
<li><code>'SHA-1'</code></li>
<li><code>'SHA-256'</code></li>
<li><code>'SHA-384'</code></li>
<li><code>'SHA-512'</code></li>
</ul>
<p>If represented as an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a>, the object must have a <code>name</code> property
whose value is one of the above listed values.</p>
<h5><code>hmacImportParams.length</code><span><a class="mark" href="webcrypto.html#hmacimportparamslength" id="hmacimportparamslength">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_hmacimportparams_length"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&#x3C;number></a></li>
</ul>
<p>The optional number of bits in the HMAC key. This is optional and should
be omitted for most cases.</p>
<h5><code>hmacImportParams.name</code><span><a class="mark" href="webcrypto.html#hmacimportparamsname" id="hmacimportparamsname">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_hmacimportparams_name"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be <code>'HMAC'</code>.</li>
</ul>
<h4>Class: <code>HmacKeyGenParams</code><span><a class="mark" href="webcrypto.html#class-hmackeygenparams" id="class-hmackeygenparams">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_hmackeygenparams"></a></h4>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<h5><code>hmacKeyGenParams.hash</code><span><a class="mark" href="webcrypto.html#hmackeygenparamshash" id="hmackeygenparamshash">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_hmackeygenparams_hash"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a></li>
</ul>
<p>If represented as a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a>, the value must be one of:</p>
<ul>
<li><code>'SHA-1'</code></li>
<li><code>'SHA-256'</code></li>
<li><code>'SHA-384'</code></li>
<li><code>'SHA-512'</code></li>
</ul>
<p>If represented as an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a>, the object must have a <code>name</code> property
whose value is one of the above listed values.</p>
<h5><code>hmacKeyGenParams.length</code><span><a class="mark" href="webcrypto.html#hmackeygenparamslength" id="hmackeygenparamslength">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_hmackeygenparams_length"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&#x3C;number></a></li>
</ul>
<p>The number of bits to generate for the HMAC key. If omitted,
the length will be determined by the hash algorithm used.
This is optional and should be omitted for most cases.</p>
<h5><code>hmacKeyGenParams.name</code><span><a class="mark" href="webcrypto.html#hmackeygenparamsname" id="hmackeygenparamsname">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_hmackeygenparams_name"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be <code>'HMAC'</code>.</li>
</ul>
<h4>Class: <code>Pbkdf2Params</code><span><a class="mark" href="webcrypto.html#class-pbkdf2params" id="class-pbkdf2params">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_pbkdf2params"></a></h4>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<h5><code>pbkdb2Params.hash</code><span><a class="mark" href="webcrypto.html#pbkdb2paramshash" id="pbkdb2paramshash">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_pbkdb2params_hash"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a></li>
</ul>
<p>If represented as a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a>, the value must be one of:</p>
<ul>
<li><code>'SHA-1'</code></li>
<li><code>'SHA-256'</code></li>
<li><code>'SHA-384'</code></li>
<li><code>'SHA-512'</code></li>
</ul>
<p>If represented as an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a>, the object must have a <code>name</code> property
whose value is one of the above listed values.</p>
<h5><code>pbkdf2Params.iterations</code><span><a class="mark" href="webcrypto.html#pbkdf2paramsiterations" id="pbkdf2paramsiterations">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_pbkdf2params_iterations"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&#x3C;number></a></li>
</ul>
<p>The number of iterations the PBKDF2 algorithm should make when deriving bits.</p>
<h5><code>pbkdf2Params.name</code><span><a class="mark" href="webcrypto.html#pbkdf2paramsname" id="pbkdf2paramsname">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_pbkdf2params_name"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be <code>'PBKDF2'</code>.</li>
</ul>
<h5><code>pbkdf2Params.salt</code><span><a class="mark" href="webcrypto.html#pbkdf2paramssalt" id="pbkdf2paramssalt">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_pbkdf2params_salt"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView" class="type">&#x3C;DataView></a> | <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a></li>
</ul>
<p>Should be at least 16 random or pseudorandom bytes.</p>
<h4>Class: <code>RsaHashedImportParams</code><span><a class="mark" href="webcrypto.html#class-rsahashedimportparams" id="class-rsahashedimportparams">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_rsahashedimportparams"></a></h4>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<h5><code>rsaHashedImportParams.hash</code><span><a class="mark" href="webcrypto.html#rsahashedimportparamshash" id="rsahashedimportparamshash">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_rsahashedimportparams_hash"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a></li>
</ul>
<p>If represented as a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a>, the value must be one of:</p>
<ul>
<li><code>'SHA-1'</code></li>
<li><code>'SHA-256'</code></li>
<li><code>'SHA-384'</code></li>
<li><code>'SHA-512'</code></li>
</ul>
<p>If represented as an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a>, the object must have a <code>name</code> property
whose value is one of the above listed values.</p>
<h5><code>rsaHashedImportParams.name</code><span><a class="mark" href="webcrypto.html#rsahashedimportparamsname" id="rsahashedimportparamsname">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_rsahashedimportparams_name"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be one of <code>'RSASSA-PKCS1-v1_5'</code>, <code>'RSA-PSS'</code>, or
<code>'RSA-OAEP'</code>.</li>
</ul>
<h4>Class: <code>RsaHashedKeyGenParams</code><span><a class="mark" href="webcrypto.html#class-rsahashedkeygenparams" id="class-rsahashedkeygenparams">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_rsahashedkeygenparams"></a></h4>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<h5><code>rsaHashedKeyGenParams.hash</code><span><a class="mark" href="webcrypto.html#rsahashedkeygenparamshash" id="rsahashedkeygenparamshash">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_rsahashedkeygenparams_hash"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a></li>
</ul>
<p>If represented as a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a>, the value must be one of:</p>
<ul>
<li><code>'SHA-1'</code></li>
<li><code>'SHA-256'</code></li>
<li><code>'SHA-384'</code></li>
<li><code>'SHA-512'</code></li>
</ul>
<p>If represented as an <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object" class="type">&#x3C;Object></a>, the object must have a <code>name</code> property
whose value is one of the above listed values.</p>
<h5><code>rsaHashedKeyGenParams.modulusLength</code><span><a class="mark" href="webcrypto.html#rsahashedkeygenparamsmoduluslength" id="rsahashedkeygenparamsmoduluslength">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_rsahashedkeygenparams_moduluslength"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&#x3C;number></a></li>
</ul>
<p>The length in bits of the RSA modulus. As a best practice, this should be
at least <code>2048</code>.</p>
<h5><code>rsaHashedKeyGenParams.name</code><span><a class="mark" href="webcrypto.html#rsahashedkeygenparamsname" id="rsahashedkeygenparamsname">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_rsahashedkeygenparams_name"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be one of <code>'RSASSA-PKCS1-v1_5'</code>, <code>'RSA-PSS'</code>, or
<code>'RSA-OAEP'</code>.</li>
</ul>
<h5><code>rsaHashedKeyGenParams.publicExponent</code><span><a class="mark" href="webcrypto.html#rsahashedkeygenparamspublicexponent" id="rsahashedkeygenparamspublicexponent">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_rsahashedkeygenparams_publicexponent"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array" class="type">&#x3C;Uint8Array></a></li>
</ul>
<p>The RSA public exponent. This must be a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array" class="type">&#x3C;Uint8Array></a> containing a big-endian,
unsigned integer that must fit within 32-bits. The <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array" class="type">&#x3C;Uint8Array></a> may contain an
arbitrary number of leading zero-bits. The value must be a prime number. Unless
there is reason to use a different value, use <code>new Uint8Array([1, 0, 1])</code>
(65537) as the public exponent.</p>
<h4>Class: <code>RsaOaepParams</code><span><a class="mark" href="webcrypto.html#class-rsaoaepparams" id="class-rsaoaepparams">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_rsaoaepparams"></a></h4>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<h5><code>rsaOaepParams.label</code><span><a class="mark" href="webcrypto.html#rsaoaepparamslabel" id="rsaoaepparamslabel">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_rsaoaepparams_label"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer" class="type">&#x3C;ArrayBuffer></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray" class="type">&#x3C;TypedArray></a> | <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView" class="type">&#x3C;DataView></a> | <a href="buffer.html#class-buffer" class="type">&#x3C;Buffer></a></li>
</ul>
<p>An additional collection of bytes that will not be encrypted, but will be bound
to the generated ciphertext.</p>
<p>The <code>rsaOaepParams.label</code> parameter is optional.</p>
<h5><code>rsaOaepParams.name</code><span><a class="mark" href="webcrypto.html#rsaoaepparamsname" id="rsaoaepparamsname">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_rsaoaepparams_name"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> must be <code>'RSA-OAEP'</code>.</li>
</ul>
<h4>Class: <code>RsaPssParams</code><span><a class="mark" href="webcrypto.html#class-rsapssparams" id="class-rsapssparams">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_class_rsapssparams"></a></h4>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<h5><code>rsaPssParams.name</code><span><a class="mark" href="webcrypto.html#rsapssparamsname" id="rsapssparamsname">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_rsapssparams_name"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type" class="type">&#x3C;string></a> Must be <code>'RSA-PSS'</code>.</li>
</ul>
<h5><code>rsaPssParams.saltLength</code><span><a class="mark" href="webcrypto.html#rsapssparamssaltlength" id="rsapssparamssaltlength">#</a></span><a aria-hidden="true" class="legacy" id="webcrypto_rsapssparams_saltlength"></a></h5>
<div class="api_metadata">
<span>Added in: v15.0.0</span>
</div>
<ul>
<li>Type: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type" class="type">&#x3C;number></a></li>
</ul>
<p>The length (in bytes) of the random salt to use.</p>
<section data-footnotes="" class="footnotes"><h3 class="sr-only" id="footnote-label">Footnotes</h3>
<ol>
<li id="user-content-fn-1">
<p>An experimental implementation of
<a href="https://wicg.github.io/webcrypto-secure-curves/">Secure Curves in the Web Cryptography API</a> as of 05 May 2022 <a href="webcrypto.html#user-content-fnref-1" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩</a> <a href="webcrypto.html#user-content-fnref-1-2" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>2</sup></a> <a href="webcrypto.html#user-content-fnref-1-3" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>3</sup></a> <a href="webcrypto.html#user-content-fnref-1-4" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>4</sup></a> <a href="webcrypto.html#user-content-fnref-1-5" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>5</sup></a> <a href="webcrypto.html#user-content-fnref-1-6" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>6</sup></a> <a href="webcrypto.html#user-content-fnref-1-7" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>7</sup></a> <a href="webcrypto.html#user-content-fnref-1-8" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>8</sup></a> <a href="webcrypto.html#user-content-fnref-1-9" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>9</sup></a> <a href="webcrypto.html#user-content-fnref-1-10" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>10</sup></a> <a href="webcrypto.html#user-content-fnref-1-11" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>11</sup></a> <a href="webcrypto.html#user-content-fnref-1-12" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>12</sup></a> <a href="webcrypto.html#user-content-fnref-1-13" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>13</sup></a> <a href="webcrypto.html#user-content-fnref-1-14" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>14</sup></a> <a href="webcrypto.html#user-content-fnref-1-15" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>15</sup></a> <a href="webcrypto.html#user-content-fnref-1-16" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>16</sup></a> <a href="webcrypto.html#user-content-fnref-1-17" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>17</sup></a> <a href="webcrypto.html#user-content-fnref-1-18" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>18</sup></a> <a href="webcrypto.html#user-content-fnref-1-19" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>19</sup></a> <a href="webcrypto.html#user-content-fnref-1-20" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>20</sup></a> <a href="webcrypto.html#user-content-fnref-1-21" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>21</sup></a> <a href="webcrypto.html#user-content-fnref-1-22" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>22</sup></a> <a href="webcrypto.html#user-content-fnref-1-23" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>23</sup></a> <a href="webcrypto.html#user-content-fnref-1-24" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>24</sup></a> <a href="webcrypto.html#user-content-fnref-1-25" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>25</sup></a> <a href="webcrypto.html#user-content-fnref-1-26" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>26</sup></a> <a href="webcrypto.html#user-content-fnref-1-27" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>27</sup></a> <a href="webcrypto.html#user-content-fnref-1-28" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>28</sup></a> <a href="webcrypto.html#user-content-fnref-1-29" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>29</sup></a> <a href="webcrypto.html#user-content-fnref-1-30" data-footnote-backref="" class="data-footnote-backref" aria-label="Back to content">↩<sup>30</sup></a></p>
</li>
</ol>
</section></section>
        <!-- API END -->
      </div>
    </div>
  </div>
</body>
</html>
